【发布时间】:2017-01-09 13:29:43
【问题描述】:
我正在使用 virtualenvwrapper 来创建/管理我的虚拟环境。在我的环境中运行 pip freeze 后,我惊讶地发现在我的新环境中安装了数十个 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
我做错了什么?
【问题讨论】:
-
@snakecharmerb: virtualenv --version 15.1.0 / virtualenvwrapper==4.7.2
-
在 virtualenv 中执行
lssitepackages是否提供相同的输出? -
你也可以粘贴
which pip的输出 -
@HennadiiMadan:我已经用您要求的信息更新了我的问题(杂项信息部分)。
-
@snakecharmerb:有趣的是,来自新环境的
lssitepackages给出了不同的输出:(twb-dataforge) me@yourbox:~/Work/ITProj/twb/dataforge$ lssitepackages easy_install.py pip pkg_resources setuptools-32.3.1.dist-info wheel-0.29.0.dist-info easy_install.pyc pip-9.0.1.dist-info setuptools wheel
标签: python virtualenv virtualenvwrapper