跨平台工具将python的用户bin放在path中,不需要sudo/runas!

pybin的Python项目详细描述


Latest PyPI versionSupported Python versionsLicense

通过pip install --user ...安装包时,任何可执行文件都会 放在一个特别的目录中,专门为预定的用户。不幸的是, 此位置很可能不包含在用户的路径变量中。所以为了 例如,如果您执行了pip3 install --user hatch,然后尝试了解更多 关于您的新工具通过hatch --help,它将无法定位。 见:https://github.com/pypa/pip/issues/3813

pybin通过为 找到python的用户bin并有选择地更新用户路径。它支持 所有主要操作系统,不需要提升权限!

Fear not, this only modifies the user PATH; the system PATH is never touched nor even looked at!

安装

pybin作为一个通用的 wheel和在linux/macos和windows上可用,并支持 python 2.6-2.7/3.3+和pypy。

$ pip install pybin

不要使用--user

命令

只有2个!

皮宾

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

  Shows the location of the bin directory and whether or not it is in the
  user PATH.

Options:
  -p, --pypath TEXT  An absolute path to a Python executable.
  --version          Show the version and exit.
  -h, --help         Show this message and exit.

Commands:
  put  Updates the user PATH

Pybin Put

$ pybin put -h
Usage: pybin put [OPTIONS]

  Updates the user PATH. The shell must be restarted for the update to take
  effect.

Options:
  -p, --pypath TEXT  An absolute path to a Python executable.
  -f, --force        Update PATH even if it appears to be correct.
  -h, --help         Show this message and exit.

API

>>>frompybinimportin_path,locate,put_in_path>>>in_path()False>>>locate()'C:\\Users\\Ofek\\AppData\\Roaming\\Python\\Python36\\Scripts'>>>success=put_in_path()

手动修改

使用pybin显示的位置与这个非常全面的文档相一致 Java提供了:https://www.java.com/en/download/help/path.xml

许可证

Pybin在这两个条件下进行分配

由你选择。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Android:位置服务权限   java Android Studio SQLite数据库创建不起作用?   java在Spring boot中添加会话bean导致没有为作用域“Session”注册作用域   正则表达式Java:从组中删除多次出现的不可打印字符   计算行和时出现java错误   java如何将存储在移动设备中的录制视频的Uri传递给另一个活动   java如何从加密字符串中获取原始字符串值?   java无法初始化jNativeHook 2.0   java一个应用程序中的两个并行通知(安卓)   java如何从Android上的Locale对象获取脚本?   不同类之间的java函数调用   java Spring MVC带EXT JS错误:DispatcherServlet noHandlerFound   java场景2D在表的顶部添加参与者   java Groovy ConcurrentHashMap forEach调用   java从数据库查询中重新格式化json   java单例类可以是泛型的吗?   java循环遍历正则表达式匹配项并替换当前匹配项   jdbc Java数据库元数据   爪哇为什么是一种特殊的番石榴秒表。调用比其他调用晚很多吗?(以邮递方式输出)   java使用递归传递带有基本情况的参数