python - 卸载 Ubuntu 18.04 中具有多个 python 版本的所有 Python 包

标签 python python-3.x tensorflow jupyter-notebook ubuntu-18.04

当我输入 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 list,这些就是我得到的包。因此理论上,您可以删除除这些软件包之外的所有软件包:

$ 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)

关于python - 卸载 Ubuntu 18.04 中具有多个 python 版本的所有 Python 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59717007/

相关文章:

python - 在 PyQtGraph 中移除/删除图例

python - 同时执行操作与排队执行操作

python - python 中的属性错误不会消失

python - 如何修复 "ModuleNotFoundError: No module named ' keras.layers.advanced_activations'“

python - 使用 Python 教程进行测试驱动开发 : Error trying to open Firefox with Selenium on MacOSX

python - 尝试添加无效/有效的输入系统

django - 为什么 widthratio(乘法)在我的模板中不起作用?

python-3.x - 使用sys.exit()时捕获错误

ubuntu - TensorFlow 找不到集成 GPU

python - Tensorflow:如何从向量字典构建矩阵?