我正在尝试删除我在 16.04 中安装的所有非系统 Python 2.7 库。我想将我的 Python 库列表重置为其默认值。
我已经手动删除了大部分库,但仍然有 200 多个库。从下面的列表中,我真的不确定哪些是系统库,哪些不是。
这是我使用以下方法得到的列表pip freeze | grep -v "^-e"
:
absl-py==0.6.1
adium-theme-ubuntu==0.3.4
alabaster==0.7.10
ann-visualizer==2.4
appdirs==1.4.3
argh==0.26.2
args==0.1.0
asn1crypto==0.23.0
astor==0.7.1
astroid==1.4.9
atari-py==0.0.18
attrs==17.2.0
autopep8==1.3.2
Babel==2.4.0
backports-abc==0.4
backports.functools-lru-cache==1.3
backports.shutil-get-terminal-size==1.0.0
backports.ssl-match-hostname==3.5.0.1
backports.tempfile==1.0rc1
backports.weakref==1.0rc1
bcrypt==3.1.3
BeautifulSoup==3.2.1
beautifulsoup4==4.6.0
bleach==3.1.0
blinker==1.3
brewer2mpl==1.4.1
bs4==0.0.1
ccsm==0.9.12.3
certifi==2018.1.18
cffi==1.11.0
chardet==3.0.4
Click==7.0
clint==0.5.1
cloudpickle==0.5.5
cma==2.5.3
cmarkgfm==0.4.2
colorama==0.3.9
configparser==3.5.0
contextlib2==0.5.5
convnetskeras==0.1
cryptography==2.2.1
cssselect==0.9.1
cycler==0.10.0
Cython==0.25.2
dask==0.19.1
db.py==0.5.3
debtags==2.0
decorator==4.0.11
defer==1.0.6
dirspec==13.10
docopt==0.6.2
docutils==0.13.1
duplicity==0.7.6
EasyProcess==0.2.3
entrypoints==0.2.2
enum==0.4.6
enum34==1.1.6
ffn==0.1.12
flake8==3.5.0
funcsigs==1.0.2
functools32==3.2.3.post2
future==0.16.0
futures==3.2.0
gast==0.2.0
ggplot==0.11.2
gitdb2==2.0.2
GitPython==2.1.5
gmpy==1.17
gmpy2==2.0.7
gnureadline==6.3.3
goose-extractor==1.0.25
graphviz==0.5.2
grpcio==1.17.0
gyp==0.1
html5lib==1.0.1
httpbl==1.0.1
httplib2==0.9.1
idna==2.6
imagesize==0.7.1
impacket==0.9.12
inflection==0.3.1
ipaddress==1.0.18
ipykernel==4.3.1
ipython==5.0.0
ipython-genutils==0.2.0
ipywidgets==7.1.2
isort==4.2.5
itsdangerous==0.24
jedi==0.10.2
jieba==0.35
Jinja2==2.8
jiphy==1.2.1
jsondatabase==0.1.7
jsonschema==2.6.0
jupyter-client==5.2.3
jupyter-console==5.2.0
jupyter-core==4.4.0
jupyterlab-launcher==0.10.5
keyring==9.0
kiwisolver==1.0.1
lazy-object-proxy==1.2.2
lockfile==0.12.2
lxml==4.1.1
Markdown==2.6.11
MarkupSafe==0.23
marshmallow==2.15.0
MAT==0.6.1
matplotlib==2.2.3
maxminddb==1.4.1
mccabe==0.6.1
mechanize==0.2.5
mido==1.2.3
mistune==0.7.3
mock==2.0.0
more-itertools==2.2
mutagen==1.31
nbconvert==5.1.1
nbformat==4.3.0
ndg-httpsclient==0.4.2
netifaces==0.10.4
networkx==1.11
nose==1.3.7
notebook==5.4.1
numexpr==2.6.1
numpy==1.11.0
oauth2client==4.0.0
oauthlib==2.0.1
obfsproxy==0.2.13
oneconf==0.3.9
packaging==16.8
PAM==0.4.2
pandocfilters==1.4.1
paramiko==2.3.1
parsel==1.2.0
pathlib2==2.3.0
pathtools==0.1.2
patsy==0.4.1
pbr==3.0.0
pcapy==0.10.8
pdfrw==0.2
pep8==1.7.0
pexpect==4.2.1
phe==1.3.0
pickleshare==0.7.3
Pillow==5.2.0
piston-mini-client==0.7.5
pkginfo==1.4.2
plotly==2.0.7
ply==3.10
pocketsphinx==0.1.3
prettytable==0.7.2
prompt-toolkit==1.0.3
protobuf==3.6.1
psutil==5.2.1
ptyprocess==0.5.2
pyasn1==0.1.9
pyasn1-modules==0.0.8
PyAudio==0.2.11
pybars3==0.9.3
pycairo==1.18.0
pycodestyle==2.3.1
pycparser==2.18
pycrypto==2.6.1
pycryptodome==3.4.7
pycryptodomex==3.6.6
pycups==1.9.73
PyDispatcher==2.0.5
pydot==1.2.2
pydot2==1.0.33
pyflakes==1.5.0
pygame===1.9.1release
pyglet==1.2.4
Pygments==2.2.0
pygobject==3.20.0
PyInstaller==3.2
PyJWT==1.7.1
pylint==1.6.5
PyMeta3==0.5.1
pymongo==3.4.0
PyNaCl==1.1.2
PyOpenGL==3.1.0
pyOpenSSL==17.5.0
pypandoc==1.3.3
pyparsing==2.2.0
PyPDF2==1.26.0
PyPrind==2.9.9
pyptlib==0.0.6
pyserial==3.0.1
pysmi==0.1.3
pysnmp==4.4.6
PySocks==1.6.8
Pyste==0.9.10
python-apt==1.1.0b1+ubuntu0.16.4.3
python-augeas==0.5.0
python-dateutil==2.6.1
python-debian==0.1.27
python-docx==0.8.7
python-gflags==3.1.1
python-nmap==0.6.1
pytz==2018.3
PyWavelets==1.0.0
pyxdg==0.25
PyYAML==3.12
pyzmq==15.3.0
QtAwesome==0.4.4
qtconsole==4.2.1
QtPy==1.2.1
queuelib==1.4.2
raven==6.6.0
readme-renderer==22.0
requests==2.18.4
requests-file==1.4
requests-oauthlib==0.8.0
requests-toolbelt==0.8.0
retrying==1.3.3
rope==0.10.5
rpy2==2.8.3
rsa==3.4.2
scandir==1.7
Send2Trash==1.5.0
service-identity==17.0.0
sh==1.12.14
shortuuid==0.5.0
simplegeneric==0.8.1
simplejson==3.8.1
singledispatch==3.4.0.3
six==1.11.0
smmap2==2.0.3
snowballstemmer==1.2.1
software-center-aptd-plugins==0.0.0
SpeechRecognition==3.7.1
Sphinx==1.5.3
stevedore==1.30.0
subprocess32==3.2.7
tables==3.2.3.1
tabulate==0.8.2
termcolor==1.1.0
terminado==0.8.1
testpath==0.3
tldextract==1.5.1
toolz==0.9.0
tornado==4.4
tqdm==4.27.0
traitlets==4.3.2
twine==1.12.1
Twisted==16.0.0
ubuntuone-client-data==14.4
unity-lens-photos==1.0
update-checker==0.16
uritemplate==3.0.0
urllib3==1.22
virtualenv==15.1.0
virtualenv-clone==0.4.0
virtualenvwrapper==4.8.2
w3lib==1.17.0
watchdog==0.8.3
wcwidth==0.1.7
webencodings==0.5.1
Werkzeug==0.12.1
widgetsnbextension==3.1.4
wrapt==1.10.10
ws4py==0.5.1
xdot==0.6
zope.interface==4.1.3
答案1
我不知道有没有直接的方法。关于通过 APT 安装的软件包,你可以使用以下命令列出软件包
sudo apt list --installed | grep python
并小心地删除它们。系统会要求您确认删除依赖项。当然,您不会删除任何将 Python 包完全拉出的内容。
关于通过 pip 安装的软件包,https://stackoverflow.com/a/24736563/3081478可能会给你一些提示。
采用另一种方法,您可以启动一个新的 16.04 VM,运行pip freeze | grep -v "^-e"
它并将其与当前 VM 进行区分。