我在 Azure 上设置了一个运行 Ubuntu 的虚拟机:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial
然后验证 Python 二进制文件和版本:
$ which python
/usr/bin/python
$ python --version
Python 2.7.12
$ which python3
/usr/bin/python3
$ python3 --version
Python 3.5.2
我安装了 Python 3.6
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt-get update
$ sudo apt-get install python3.6
然后我删除了它
$ sudo apt-get remove python3.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libpython3.6-minimal libpython3.6-stdlib python3.6-minimal
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
python3.6
0 upgraded, 0 newly installed, 1 to remove and 6 not upgraded.
After this operation, 334 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 85368 files and directories currently installed.)
Removing python3.6 (3.6.8-1+xenial1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
但它仍然安装:
$ python3 --version
Python 3.5.2
$ python3.6 --version
Python 3.6.8
现在我不能再删除它,因为apt-get
说它没有安装:
$ sudo apt-get remove python3.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'python3.6' is not installed, so not removed
The following packages were automatically installed and are no longer required:
libpython3.6-minimal libpython3.6-stdlib python3.6-minimal
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
我怎样才能删除它?
这里任何尝试或想要尝试相同事情的人,不要在 Ubuntu 上以这种方式删除 Python3!它可能会删除您的整个 ubuntu 桌面。如果您遇到问题:
如果您无法打开终端,请按Ctrl++Alt获取F1shell 并运行相同的命令。
您需要删除与以下内容一起安装的软件包
python3.6
:这将删除
apt-get
告诉您何时删除的软件包python3.6
:包括
python3.6-minimal
哪个是python3.6
二进制文件的来源。