[英]Why pip uses global packages when created a clean virtualenv using python2.7?
I tried different suggestions from other topic but no one helped. 我尝试了与其他主题不同的建议,但没有人提供帮助。 I have latest virtualenv and pip installed.
我安装了最新的virtualenv和pip。
What I do thats: 我所做的就是:
virtualenv venv
source venv/bin/activate
pip list
it shows me global packages. 它向我显示了全局软件包。
Also tried export PYTHONPATH=
before creating venv, but nothing helped. 在创建venv之前也尝试了
export PYTHONPATH=
,但是没有任何帮助。 On my laptop it works but on remote server - does not. 在我的笔记本电脑上,它可以工作,但在远程服务器上-不能。
Maybe there is any global settings/config for it?? 也许有任何全局设置/配置?
UPDATED: It is only for python2, for python3 works fine 更新:仅适用于python2,适用于python3
i would say to update the python version. 我会说要更新python版本。 i have 2.7.15 and runs as expected.
我有2.7.15并按预期运行。 Also try --no-site-packages to workaround.
也可以尝试--no-site-packages来解决。 this should not give access to global site-packages
这不应允许访问全局站点程序包
The problem was that WebFaction hosting has python customisations which includes packages at ~/lib/python2.7 directory. 问题是WebFaction托管具有python自定义项,其中包括〜/ lib / python2.7目录中的软件包。
I asked the support and a guy created an empty file named sitecustomize.py in the /home/user/webapps/myapp/env/lib/python2.7 我请求支持人员,一个人在/home/user/webapps/myapp/env/lib/python2.7中创建了一个名为sitecustomize.py的空文件。
That empty file overrides python customizations and everything works fine. 该空文件将覆盖python自定义,一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.