问题描述
一段时间以来,我一直在许多Python项目中使用virtualenv。当我尝试激活我的一个virtualenv时,我输入:
For a while, I have been using virtualenv's for many python projects. When I tried to activate one of my virtualenv's, I typed:
source venv/bin/activate
通常可以做到这一点。但是,不是我的命令提示符说:
Which generally does the trick. However, instead of my command prompt saying:
(venv)me@example:~/
它说:
(root)me@example:~/
我的python版本要求和我在virtualenv上安装的软件包都是未能识别。为什么会发生这种情况?
My python version requirement and my packages that I installed on the virtualenv are not recognized. Why does this happen?
推荐答案
尝试:
source activate venv
(而不是 source venv / bin / activate
或 ./ venv / bin / activate.sh
等)
THundtMac$ source activate venv
(venv) THundtMac$ source deactivate
THundtMac$ . ./venv/bin/activate
(root) THundtMac$ source deactivate
THundtMac$
我认为这与使用Anaconda与点子安装版本有关。 (我现在正在使用conda安装的计算机。)
I think this has to do with using Anaconda vs the pip-installed version. (I'm using the conda-installed one now.)
这篇关于Virtualenv说“ root”而不是virtualenv的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!