Skip to main content

用于将位置添加到用户 PATH 的跨平台工具,无需 sudo/runas!

项目描述

最新的 PyPI 版本 特拉维斯 CI AppVeyor CI 支持的 Python 版本 执照

曾经想发布一个很酷的新应用程序,但发现很难将其位置添加到用户的 PATH 中?我也是!该工具可以在所有主要操作系统上为您执行此操作,并且不需要提升权限!

不用担心,这只会修改用户 PATH;系统 PATH 从未被触及,甚至未被查看!

<nav class="contents" id="table-of-contents" role="doc-toc">

目录

</nav>

安装

adduserpath 作为通用轮子在PyPI上分发,可在 Linux/macOS 和 Windows 上使用,并支持 Python 2.6-2.7/3.3+ 和 PyPy。

$ pip install adduserpath

命令

只有3个!

$ userpath -h
Usage: userpath [OPTIONS] COMMAND [ARGS]...

Options:
  --version   Show the version and exit.
  -h, --help  Show this message and exit.

Commands:
  append   Appends to the user PATH
  prepend  Prepends to the user PATH
  verify   Checks if locations are in the user PATH
示例运行

API

>>> import userpath
>>> location = r'C:\Users\Ofek\Desktop\test'
>>>
>>> userpath.in_current_path(location)
False
>>> userpath.in_new_path(location)
False
>>> userpath.append(location)
True
>>> userpath.in_new_path(location)
True
>>> userpath.need_shell_restart(location)
True

执照

userpath 是根据两者的条款分发的

由您选择。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

adduserpath-0.4.0.tar.gz (9.4 kB 查看哈希

已上传 source

内置分布

adduserpath-0.4.0-py2.py3-none-any.whl (8.1 kB 查看哈希

已上传 py2 py3