我在 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,而突触告诉我 PyQt4 已安装。
我相信我搞砸了我的 python 版本:
因此,我想删除 python 2.7.8。
拜托,有人能指点我怎么做吗?
我非常感谢你的帮助。
此致,
皮埃尔
最佳答案
Python 不提供 uninstall
目标在它生成的 Makefile 中,因此您必须手动删除文件。不过,在您的情况下这应该不会太难,因为您将它安装在 /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
如果您在文件管理器中检查这些目录,您可以轻松查看最近添加的内容。您的问题中显示的交互式 session 的输出显示编译日期为
Jan 14 2015, 18:34:11
。 - 所以安装的文件在几分钟后都会有时间戳。
关于python-2.7 - Python & Ubuntu 14.04\ 删除手动安装的python版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27964639/