簡體   English   中英

在具有多個 Python 版本的 Ubuntu 18.04 中卸載所有 Python 包

[英]Uninstall all Python packages in Ubuntu 18.04 having multiple python versions

當我輸入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)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM