使用pyenv,如何在Virtualenv中安装全局CLI并使它们可用?
我想始终可以访问 black 有许多pip安装的cli。如果我将某个python安装标记为全球(la pyenv global 3.10.0
),然后我可以使用pip
将这些CLI安装到该全局Python的Site-packages,当我使用全球python时,Pyenv使它们可以运行。但是,一旦我进入Virtualenv,它们就变得不可用。这使我不再能够使用工具进行覆盖,部署和执行与系统相关的任务,而无需将这些工具安装到Virtualenv中,而我不想这样做。
是否有一个支持或共同解决此问题的方法,以便我可以安装某些包括二进制文件在内的PIP软件包,并且总是可以访问这些二进制文件?
There are many pip-installed CLI's like ansible
and black
that I want to have access to always, no matter which python version or virtualenv I am using. If I mark a certain python installation as global (a la pyenv global 3.10.0
), I can then use pip
to install these CLI's into that global python's site-packages, and pyenv makes them runnable while I'm using the global python. However, they become unavailable once I'm inside a virtualenv. This makes me no longer able to use tools for linting, deploying, and doing generic system-related tasks without installing these tools into the virtualenv, which I do not want to do.
Is there a supported or common way of solving this problem so that I can install certain pip packages which include binaries, and have those binaries always accessible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

Python Packaging Authority 有一个名为 PipX 正是为了这个目的,看看吧!
来自自述文件:
The Python Packaging Authority has a tool called PipX which is meant for exactly this purpose, check it out!
From the readme: