使用Pipenv创建虚拟环境
我想在Pipenv中有两个版本的模块,一个版本(例如:较新版本),另一个版本(例如,较新版本)(例如:旧版本),但是当我使用Pipenv安装软件包时,它也将与PIP一起使用,我不适用知道如何使用Pycahrm IDE中的Pipenv创建一个不同的环境,这些软件包不会在PIP中安装。
每当我使用pipenv执行命令时,Pycharm也将此代码告知我:
礼貌通知:Pipenv发现自己在虚拟环境中运行,因此它将自动使用该环境,而不是为任何项目创建自己的环境。您可以设置Pipen v_ignore_virtualenvs = 1强迫pipenv忽略该环境并创建自己的环境。您可以设置pipenv_verbosity = -1来抑制此警告。
如何将pipenv_ignore_virtualenvs设置为1?
是否可以一次使用两个不同的环境?
i want to have two version of a module, one version in pip(e.g:newer version) and the other(e.g: older version) in pipenv, but when i install a package using pipenv, it will also works with pip, i don't know how to create a different environment with pipenv in pycahrm IDE that the packages won't install in pip.
and also pycharm inform me this code every time i execute a command using pipenv:
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPEN
V_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
how can i set pipenv_ignore_virtualenvs to 1?
is it even possible to use two different enviroment at one time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基本上,您不能,因为它不依赖于应安装软件包的PIP(或Pipenv或Poetry)。 python将在配置在任何位置进行基于
sys.prefix
或sys.prefix_exec
的值安装软件包, .org/3/library/venv.html#venv-def“ rel =“ nofollow noreferrer”>在这里。如果您想管理依赖关系的两个不同版本,那么我能想到的一件事是有两个独立的虚拟环境,每个环境都有自己的依赖关系。然后,您可以根据需要在环境之间切换。但是,您不能在同一环境中安装两个版本的同一软件包(除非您修改其源并在本地安装它),并且在PIP或任何依赖安装工具之间绝对更改无济于事。
在这里以及为什么它不依赖于安装的pip
Basically, you can't, because it doesn't depend on pip (or pipenv or poetry) where the packages should be installed. Python will install packages wherever it's configured to do based on the values of
sys.prefix
orsys.prefix_exec
, as explained here.If you want to manage two different versions of a dependency, the one thing I can think of is having two separate virtual environments, each with its own dependencies. Then, you can switch between environments as you please. But you can't have two versions of the same package installed (unless you modify its source and install it locally as well) in the same environment, and definitely changing between pip or any dependency installation tool won't help you.
Here's a nice article that explains what happens when you activate a virtual environment and why it does not depend on pip where they are installed