python - 在具有多个 python 版本的 Ubuntu 18.04 中卸载所有 Python 包
问题描述
当我键入python
并点击选项卡时,将显示以下包
python python3 python3.6m python3m
python2 python3.6 python3.6m-config python3m-config
python2.7 python3.6-config python3-config
当我键入pip list
以下包时,会显示
absl-py 0.8.0
apturl 0.5.2
asn1crypto 0.24.0
astor 0.8.0
astroid 2.2.5
attrs 19.1.0
backcall 0.1.0
bleach 3.1.0
Brlapi 0.6.6
certifi 2018.1.18
chardet 3.0.4
command-not-found 0.3
cryptography 2.1.4
cupshelpers 1.0
cycler 0.10.0
decorator 4.4.0
defer 1.0.6
defusedxml 0.6.0
distro-info 0.18ubuntu0.18.04.1
entrypoints 0.3
gast 0.2.2
google-pasta 0.1.7
grpcio 1.23.0
h5py 2.9.0
httplib2 0.9.2
idna 2.6
ipykernel 5.1.2
ipython 7.8.0
ipython-genutils 0.2.0
ipywidgets 7.5.1
isort 4.3.21
jedi 0.15.1
Jinja2 2.10.1
joblib 0.14.0
jsonschema 3.0.2
jupyter 1.0.0
jupyter-client 5.3.3
jupyter-console 6.0.0
jupyter-core 4.5.0
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.0
keyring 10.6.0
keyrings.alt 3.0
kiwisolver 1.1.0
language-selector 0.1
launchpadlib 1.10.6
lazr.restfulclient 0.13.5
lazr.uri 1.0.3
lazy-object-proxy 1.4.2
louis 3.5.0
macaroonbakery 1.1.3
Markdown 3.1.1
MarkupSafe 1.1.1
matplotlib 3.1.1
mccabe 0.6.1
mistune 0.8.4
nbconvert 5.6.0
nbformat 4.4.0
netifaces 0.10.4
nltk 3.4.5
notebook 6.0.1
numpy 1.17.2
oauth 1.0.1
oauthlib 3.1.0
olefile 0.45.1
pandas 0.25.1
pandocfilters 1.4.2
parso 0.5.1
pexpect 4.2.1
pickleshare 0.7.5
Pillow 5.1.0
pip 19.3.1
prometheus-client 0.7.1
prompt-toolkit 2.0.9
protobuf 3.9.1
ptyprocess 0.6.0
pycairo 1.16.2
pycrypto 2.6.1
pycups 1.9.73
Pygments 2.4.2
pygobject 3.26.1
pylint 2.3.1
pymacaroons 0.13.0
PyNaCl 1.1.2
pyparsing 2.4.2
pyRFC3339 1.0
pyrsistent 0.15.4
PySocks 1.7.1
python-apt 1.6.4
python-dateutil 2.6.1
python-debian 0.1.32
pytz 2018.3
pyxdg 0.25
PyYAML 3.12
pyzmq 18.1.0
qtconsole 4.5.5
reportlab 3.4.0
requests 2.18.4
requests-oauthlib 1.3.0
requests-unixsocket 0.1.5
scikit-learn 0.21.3
scipy 1.3.1
SecretStorage 2.3.1
Send2Trash 1.5.0
setuptools 41.2.0
simplejson 3.13.2
six 1.11.0
sklearn 0.0
swampy 3.0.1
system-service 0.3
systemd-python 234
tb-nightly 1.14.0a20190603
tensorflow 2.0.0b1
termcolor 1.1.0
terminado 0.8.2
testpath 0.4.2
textblob 0.15.3
tf-estimator-nightly 1.14.0.dev2019060501
tornado 6.0.3
traitlets 4.3.2
tweepy 3.8.0
typed-ast 1.4.0
ubuntu-drivers-common 0.0.0
ufw 0.36
unattended-upgrades 0.1
urllib3 1.22
virtualenv 16.7.5
wadllib 1.3.2
wcwidth 0.1.7
webencodings 0.5.1
Werkzeug 0.15.6
wheel 0.30.0
widgetsnbextension 3.5.1
wrapt 1.11.2
xkit 0.0.0
zope.interface 4.3.2
我想删除所有的包,但保留那些对操作系统很重要的包
解决方案
如果我创建一个 ubuntu 18.04 容器,并安装 python、python3 并做一个 pip 列表,这些就是我得到的包。所以理论上,你可以删除除这些包之外的所有包:
$ docker run -it --rm ubuntu:18.04 bash
# inside the docker container:
$ apt update
$ apt install python python-pip python3 python3-pip
$ pip list
asn1crypto (0.24.0)
cryptography (2.1.4)
enum34 (1.1.6)
idna (2.6)
ipaddress (1.0.17)
keyring (10.6.0)
keyrings.alt (3.0)
pip (9.0.1)
pycrypto (2.6.1)
pygobject (3.26.1)
pyxdg (0.25)
SecretStorage (2.3.1)
setuptools (39.0.1)
six (1.11.0)
wheel (0.30.0)
$ pip3 list
asn1crypto (0.24.0)
cryptography (2.1.4)
idna (2.6)
keyring (10.6.0)
keyrings.alt (3.0)
pip (9.0.1)
pycrypto (2.6.1)
pygobject (3.26.1)
pyxdg (0.25)
SecretStorage (2.3.1)
setuptools (39.0.1)
six (1.11.0)
wheel (0.30.0)
推荐阅读
- c# - Asp.net Core Websocket 是否与 linux/docker 兼容?
- chef-infra - 厨师:如何同时在多个节点上运行配方
- python - 用于在 Excel 表中进行日期比较的 Python 脚本
- angularjs - 我想将这两个 angularJS 依赖注入集成到一个项目中
- java - Unity 3D Android 项目未构建
- php - Laravel 文档根目录被 HTTP 403 错误禁止
- uwp - 桌面桥 UWP 应用中的功能声明
- c# - 如何获取复杂 JSON 数据中的元素值
- pyspark - PySpark:根据当前行值计算行数
- android - 使用 Roboelectric 3.8 运行单元测试时出现 NoClassDefFoundError