[英]How to active a virtualenv with pyenv installed
I use pyenv
for handling my python versions. 我使用
pyenv
处理我的python版本。 I also use virtualenv
for creating my virtual environments. 我还使用
virtualenv
创建我的虚拟环境。 In a new project, I made a new virtual environment with python -m venv venv
to make a directory called venv
that has a fresh python 3.6. 在一个新项目中,我使用
python -m venv venv
创建了一个新的虚拟环境,以创建一个名为venv
的目录,该目录具有一个新的python 3.6。 I then did source venv/bin/activate
expecting that to make venv/bin/python
to be my default python
from this directory, but when I do command -v python
, I am told that /Users/TheStrangeQuark/.pyenv/shims/python
is still the path. 然后我确实做了
source venv/bin/activate
期望使venv/bin/python
成为该目录中的默认python
,但是当我执行command -v python
,会被告知/Users/TheStrangeQuark/.pyenv/shims/python
仍然是路径。 I also checked with python -c "import sys; print(sys.executable)"
and was printed with /Users/jhuneau/.pyenv/versions/3.6.2/bin/python
. 我还检查了
python -c "import sys; print(sys.executable)"
,并使用/Users/jhuneau/.pyenv/versions/3.6.2/bin/python
打印。
Why is source venv/bin/activate
not working to set the python executable in this directory to use the virtual environment? 为什么
source venv/bin/activate
无法在该目录中将python可执行文件设置为使用虚拟环境?
I think you should try: 我认为您应该尝试:
source venv/bin/activate
instead of 代替
source venv/bin/active
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.