问题描述
我在 Windows 7 上的 c:/python27
中全局安装了 python 2.7.
I have python 2.7 installed globally in c:/python27
on Windows 7.
我使用 pip install virtualenv
然后我使用 python.exe -m virtualenv c:/virtualenv/env1
创建一个虚拟环境并激活它:
I then create a virtual env using python.exe -m virtualenv c:/virtualenv/env1
and activate it:
cd c:/virtualenv/env1/scripts
激活
提示我们一切正常的变化:
The prompt change showing we that everything worked properly:
(env1) c:\virtualenv\env1\Scripts>
现在我的问题是我刚刚创建的虚拟环境仍然从全局 python27 继承包,我不想要那样.
Now my problem is that my just created virtual env is still inheriting packages from the global python27 and I don't want that.
我尝试使用 --no-site-packages
创建一个新的虚拟环境,但同样的问题.在 virtualenv 文档 中,它是说 --system-site-packages
可用于自愿从全局 python 继承包,这意味着默认行为应该是不具有该继承...
I try creating a new virtual env using --no-site-packages
but same problem.In the virtualenv documentation it is said that the --system-site-packages
may be use to volontarily inherit packages from global python and that means that default behavior should be to not have that inheritance...
知道我的设置有什么问题吗?
Any idea what is wrong with my setup?
推荐答案
在评论线程之后...解决方案是不要将您的站点包放在您的 PYTHONPATH 中.:)
After the comment thread... solution is don't put your site-packages in your PYTHONPATH. :)
这篇关于无法将 virtualenv 配置为不在 Windows 上的虚拟环境之外使用包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!