提问者:小点点

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


当我键入python并点击tab时,将显示以下包

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 

我想删除所有的软件包,但保留那些对操作系统很重要的软件包


共1个答案

匿名用户

如果我创建一个Ubuntu18.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)