python - 从 Ubuntu 15.04 中删除 Mercurial-common

标签 python ubuntu mercurial apt-get

我在 Ubuntu 15.04 上遇到 Python 2.x 问题。我想完全卸载并重新安装Python。我无法卸载 Python,因为 Mercurial-common 依赖于它。我尝试删除它,但收到错误:

➜  ~  sudo apt-get remove --purge mercurial-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gnome-control-center-data gnome-icon-theme gnome-icon-theme-symbolic gnome-settings-daemon libcolord-gtk1 libexpat1-dev libgoa-backend-1.0-1 libjs-excanvas libpython3-dev
  libpython3.4-dev python3-colorama python3-dev python3-distlib python3-wheel python3.4-dev
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  mercurial-common*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 8,610 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 206144 files and directories currently installed.)
Removing mercurial-common (3.1.2-2+deb8u1build0.15.04.2) ...
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
dpkg: error processing package mercurial-common (--purge):
 subprocess installed pre-removal script returned error exit status 1
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 mercurial-common
E: Sub-process /usr/bin/dpkg returned an error code (1)

最佳答案

mercurial-common 删除脚本使用 python

/var/lib/dpkg/info/mercurial-common.prerm

如果您输入 which pyclean 我认为它存在。 不过我怀疑你的 python 问题阻止了它的工作。 (您可以尝试手动运行它来验证这一点)

不幸的是 pyclean 位于 python-minimal 包中,因此您可能无法在 Mercurial-common 之前卸载它。

您可以尝试通过以下方式手动删除它:

sudo mv /usr/bin/pyclean /usr/bin/pyclean.backup

(记得把它放回去)。

或者不完全删除 python,您可以尝试使用 dpkg --install 在现有安装的基础上重新安装 python 包 .deb

关于python - 从 Ubuntu 15.04 中删除 Mercurial-common,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32929792/

相关文章:

python - 如何让 Sprite 在 Pygame 和 Python 中的所有计算机上均匀移动

android - 使用 Python 在 Appium/Android 上选择一个元素,该元素与 UIAutomatorViewer 上的另一个元素具有相同的类和相同的索引

python - 在伊博语文本中查找缩略词模式 (*'*)

Mercurial:从旧存储库中的现有文件夹创建新存储库

python - 扩展 Mercurial 时使用 --quiet 标签

python - 如何将自己分配给自己的另一个实例

python-2.7 - 如何使用 Python 2.7 将 shell 命令行输出放到 Ubuntu 上的变量中

php - Laravel 计划任务未与 Cron 一起运行,但与 artisan 一起使用

python - Linux中的Python和python3有不同的pip吗?

mercurial - 如何获取远程服务器hg路径?