首页 > 解决方案 > `pip3 freeze` 在开头打印很多包

问题描述

我创建virtualenv和命令pip3 freeze是因为我python3用来运行我的项目。

virtualenv .
source bin/activate
pip3 freeze

但是,pip3 freeze即使我还没有安装任何包,也会打印出 default(?) python3 包:

backports.weakref==1.0rc1
bleach==1.5.0
certifi==2017.7.27.1
chardet==3.0.4
configparser==3.5.0
defusedxml==0.5.0
Django==1.11.12
django-allauth==0.32.0
django-crispy-forms==1.6.1
django-filter==1.0.4
django-widget-tweaks==1.4.1
djangorestframework==3.7.7
enum34==1.1.6
flake8==3.4.1
flake8-docstrings==1.1.0
flake8-polyfill==1.0.1
html5lib==0.9999999
idna==2.5
Keras==2.0.6
Markdown==2.6.8
mccabe==0.6.1
numpy==1.13.1
oauthlib==2.0.2
olefile==0.44
Pillow==4.2.1
protobuf==3.3.0
pycodestyle==2.3.1
pydocstyle==2.0.0
pyflakes==1.5.0
python3-openid==3.1.0
pytz==2018.3
PyYAML==3.12
requests==2.18.3
requests-oauthlib==0.8.0
scipy==0.19.1
six==1.10.0
snowballstemmer==1.2.1
tensorflow==1.2.1
Theano==0.9.0
urllib3==1.22
Werkzeug==0.12.2

显然我不想为我的虚拟机安装 tensorflow 和 Theano。:(

为什么它有默认(?)python3 包?我们可以从头开始吗?

标签: pythondjangopython-3.xvirtualenv

解决方案


如果可以的话,你确实有这些包裹import

import sys然后检查print(sys.path)哪些目录中有你的包。

通常site-packages会列出一个类似的目录。

您可以pip3 uninstall <package>不想要的,如果需要,从site-packages目录中删除。但是pip3 uninstall是首选。

请注意,您还可以通过执行以下操作来了解您的包裹位置:pip3 show numpy

哪个打印:

Name: numpy
Version: 1.14.3
Summary: NumPy: array processing for numbers, strings, records, and objects.
Home-page: http://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: None
License: BSD
Location: c:\python36\lib\site-packages
Requires:
Required-by: scipy, pandas

推荐阅读