简体   繁体   English

pipenv 在 vs 代码中设置虚拟环境的路径

[英]pipenv set path of virtual environment in vs code

I'm using visual studio code on windows 10, using python and django.我在 windows 10 上使用 Visual Studio 代码,使用 python 和 django。 The problem I have is that whenever I create a new virtual environment it takes place on its default folder, I'd like to change it to take place in the address I specify.我遇到的问题是,每当我创建一个新的虚拟环境时,它都会在其默认文件夹中进行,我想将其更改为在我指定的地址中进行。

How can I specify the folder that virtual environment takes place in?如何指定虚拟环境所在的文件夹?

So far, I've tried different ways to solve this problem, but none of work for me, this could be because of the system and tools I'm using,到目前为止,我已经尝试了不同的方法来解决这个问题,但对我来说都不起作用,这可能是因为我正在使用的系统和工具,

I've tried setting the path variables using set command, like:我尝试使用 set 命令设置路径变量,例如:

set Path="~/.ven"

I also looked for changing the variables of pip and pipenv but I couldn't make it work.我还寻找更改 pip 和 pipenv 的变量,但我无法使其工作。 I also searched the similar questions on stackoverflow, I couldn't find a proper answer.我还在stackoverflow上搜索了类似的问题,我找不到正确的答案。 Also in the documentation of pipenv, I couldn't find the solution.同样在 pipenv 的文档中,我找不到解决方案。

Thanks for reading and your time.感谢您的阅读和您的时间。

Pipenv automatically honors the WORKON_HOME environment variable, if you have it set — so you can tell pipenv to store your virtual environments wherever you want, eg: Pipenv 自动尊重 WORKON_HOME 环境变量,如果你设置了它 - 所以你可以告诉 pipenv 将你的虚拟环境存储在你想要的任何地方,例如:

export WORKON_HOME=~/.venvs

In addition, you can also have Pipenv stick the virtualenv in project/.venv by setting the此外,您还可以让 Pipenv 将 virtualenv 粘贴在 project/.venv 中

PIPENV_VENV_IN_PROJECT =1

environment variable.环境变量。

Custom Virtual Environment Location自定义虚拟环境位置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM