使用pyenv,如何在Virtualenv中安装全局CLI并使它们可用?

发布于 01-19 07:29 字数 342 浏览 3 评论 0原文

我想始终可以访问 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独享拥抱2025-01-26 07:29:42

Python Packaging Authority 有一个名为 PipX 正是为了这个目的,看看吧!

来自自述文件:

概述:什么是 pipx?

pipx是一个帮助您安装和运行的工具
用 Python 编写的最终用户应用程序。大致类似于
macOS 的brew、JavaScript 的npx 和Linux 的apt。

它与pip密切相关。事实上,它使用 pip,但专注于
安装和管理可从以下位置运行的 Python 包
命令行直接作为应用程序。

The Python Packaging Authority has a tool called PipX which is meant for exactly this purpose, check it out!

From the readme:

Overview: What is pipx?

pipx is a tool to help you install and run
end-user applications written in Python. It's roughly similar to
macOS's brew, JavaScript's npx, and Linux's apt.

It's closely related to pip. In fact, it uses pip, but is focused on
installing and managing Python packages that can be run from the
command line directly as applications.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文