【问题标题】:Python & Ubuntu 14.04 \ removing a python version installed manuallyPython & Ubuntu 14.04 \ 删除手动安装的python版本
【发布时间】:2015-03-13 22:01:07
【问题描述】:

我在 Ubuntu 14.04 上手动安装了 2.7.8 python,但没有意识到 Ubuntu 已经附带了 2.7.6(我使用了这个方法,将 python 版本更改为 2.7.8:https://askubuntu.com/questions/101591/how-do-i-install-python-2-7-2-on-ubuntu

当我列出我系统上的 python 版本时,输出如下。

pierre@pierre-VirtualBox:~/Téléchargements$ sudo find / -type f -executable -iname 'python*' -exec file -i '{}' \; | awk -F: '/x-executable; charset=binary/ {print $1}' | xargs readlink -f | sort -u | xargs -I % sh -c 'echo -n "%: "; % -V'
/home/pierre/Téléchargements/Python-2.7.8/python: Python 2.7.8
/usr/bin/python2.7: Python 2.7.6
/usr/bin/python3.4: Python 3.4.0
/usr/bin/python3.4m: Python 3.4.0
/usr/local/bin/python2.7: Python 2.7.8

然后我用 Synaptic 安装了 PyQt4,当我检查它是否正确安装时,似乎没有。

pierre@pierre-VirtualBox:~/Téléchargements$ python
Python 2.7.8 (default, Jan 14 2015, 18:34:11) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt4
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named PyQt4

我需要 PyQt4 用于另一个程序,但这个程序没有检测到 PyQt4,而 synaptic 告诉我 PyQt4 已安装。

我相信我的 python 版本搞砸了:

  • 一方面我认为 python 2.7.8 成为默认的 python 并且被我要安装的其他程序识别(它的安装是“手动”)

  • 另一方面,synaptic 的“默认”python 版本似乎是 2.7.5,并且仅为这个版本安装了 PyQt4

因此,我想删除 python 2.7.8。 拜托,有人能指点我怎么做吗?

非常感谢您的帮助。 最好的问候,

皮埃尔

【问题讨论】:

  • 既然你是用askUbuntu的指南安装的,那你为什么不问问怎么卸载呢?

标签: python-2.7 ubuntu pyqt4 uninstallation


【解决方案1】:

Python 在它生成的 Makefile 中没有提供uninstall 目标,因此您必须手动删除这些文件。不过,在您的情况下,这应该不会太难,因为您将它安装在 /usr/local 下。

典型的python2.7安装会将所有文件放在这些位置:

    /usr/local/include/python2.7
    /usr/local/lib/python2.7
    /usr/local/lib/pkgconfig
    /usr/local/share/man/man.1
    /usr/local/bin

如果您在文件管理器中检查这些目录,您可以轻松查看最近添加的内容。您的问题中显示的交互式会话的输出显示编译日期为Jan 14 2015, 18:34:11 - 因此安装的文件将在此之后的几分钟内都有时间戳。

【讨论】:

  • 感谢您的提示,我按照您的提示手动删除了所有内容,并恢复了 Ubuntu 提供的正确 python 发行版。谢谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-01-28
  • 1970-01-01
  • 1970-01-01
  • 2013-02-17
  • 2016-02-16
  • 2013-10-21
相关资源
最近更新 更多