mkvirtualenv --no-site-packages仍在新环境

时间:2017-01-09 13:29:44

标签: python virtualenv virtualenvwrapper

我正在使用virtualenvwrapper来创建/管理我的虚拟环境。在我的环境中运行pip冻结后,我惊讶地发现在我的新环境中安装了几十个Python模块和软件包(在我知道virtualenv / wrapper之前安装)。

这不是预期的行为;我希望有一个干净的环境,只有我在该环境中安装的软件包才可用。

我正在使用的命令是:

mkvirtualenv --no-site-packages mynewenv

当我在新环境中运行pip freeze时,我会得到以下长列表(我希望在新环境中无需安装):

apturl (0.5.2)
beautifulsoup4 (4.4.1)
bleach (1.5.0)
blinker (1.3)
Brlapi (0.6.4)
chardet (2.3.0)
checkbox-support (0.22)
command-not-found (0.3)
coverage (3.7.1)
cryptography (1.2.3)
Cython (0.25.2)
decorator (4.0.10)
defer (1.0.6)
Django (1.10.5)
djangorestframework (3.5.3)
entrypoints (0.2.2)
enum34 (1.1.6)
feedparser (5.1.3)
guacamole (0.9.2)
html5lib (0.999)
httplib2 (0.9.1)
idna (2.0)
ipykernel (4.5.2)
ipython (5.1.0)
ipython-genutils (0.1.0)
ipywidgets (5.2.2)
Jinja2 (2.8)
jsonschema (2.5.1)
jupyter (1.0.0)
jupyter-client (4.4.0)
jupyter-console (5.0.0)
jupyter-core (4.2.1)
language-selector (0.1)
louis (2.6.4)
lxml (3.5.0)
lz4 (0.8.2)
Mako (1.0.3)
MarkupSafe (0.23)
mistune (0.7.3)
mockextras (1.0.2)
nbconvert (5.0.0)
nbformat (4.2.0)
notebook (4.3.1)
numpy (1.11.3)
oauthlib (1.0.3)
onboard (1.2.0)
padme (1.1.1)
pandas (0.19.2)
pandocfilters (1.4.1)
pbr (1.10.0)
pexpect (4.0.1)
pickleshare (0.7.4)
Pillow (3.1.2)
pip (9.0.1)
plainbox (0.25)
prompt-toolkit (1.0.9)
ptyprocess (0.5)
pyasn1 (0.1.9)
pycups (1.9.73)
pycurl (7.43.0)
Pygments (2.1)
pygobject (3.20.0)
PyJWT (1.3.0)
pymongo (3.4.0)
pyparsing (2.0.3)
pysmbc (1.0.15.5)
python-apt (1.1.0b1)
python-dateutil (2.6.0)
python-debian (0.1.27)
python-systemd (231)
pytz (2016.10)
pyxdg (0.25)
pyzmq (16.0.2)
qtconsole (4.2.1)
reportlab (3.3.0)
requests (2.9.1)
sessioninstaller (0.0.0)
setuptools (23.0.0)
simplegeneric (0.8.1)
six (1.10.0)
stevedore (1.15.0)
system-service (0.3)
terminado (0.6)
testpath (0.3)
tornado (4.4.2)
traitlets (4.3.1)
tzlocal (1.3)
ubuntu-drivers-common (0.0.0)
ufw (0.35)
unattended-upgrades (0.1)
unity-scope-calculator (0.1)
unity-scope-chromiumbookmarks (0.1)
unity-scope-colourlovers (0.1)
unity-scope-devhelp (0.1)
unity-scope-firefoxbookmarks (0.1)
unity-scope-gdrive (0.7)
unity-scope-manpages (0.1)
unity-scope-openclipart (0.1)
unity-scope-texdoc (0.1)
unity-scope-tomboy (0.1)
unity-scope-virtualbox (0.1)
unity-scope-yelp (0.1)
unity-scope-zotero (0.1)
urllib3 (1.13.1)
usb-creator (0.3.0)
virtualenv (15.1.0)
virtualenv-clone (0.2.6)
wcwidth (0.1.7)
wheel (0.29.0)
widgetsnbextension (1.2.6)
xdiagnose (3.8.4)
xkit (0.0.0)
XlsxWriter (0.7.3)

[[其他信息]]

virtualenv --version 15.1.0 
virtualenvwrapper==4.7.2 
OS: Ubuntu 16.0.4
Python: 2.7 & 3.5
which pip : /usr/local/bin/pip
which pip3: /usr/local/bin/pip3

我做错了什么?

1 个答案:

答案 0 :(得分:0)

你激活了virtualenv吗?它由"采购"完成。活动脚本:

source <env>/bin/activate

其他问题可能是路径中的长路径名称或空格。 pwd在你的virtualenv目录中给出了什么?