Linux 卸载从源代码构建的python?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3544378/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Uninstall python built from source?
提问by Ian P
I've installed python 2.6 from source, and somehow later mistakenly installed another python 2.6 from a package manager too.
我已经从源代码安装了 python 2.6,后来不知何故错误地从包管理器安装了另一个 python 2.6。
I can't find a way to uninstall a python that was built from source, is this possible/easy?
我找不到卸载从源代码构建的 python 的方法,这可能/容易吗?
Running ubuntu 10.04.
运行 ubuntu 10.04。
采纳答案by unutbu
You can use checkinstall to remove Python. The idea is:
您可以使用 checkinstall 来删除 Python。这个想法是:
- Install checkinstall
- Use checkinstall to make a deb of your Python installation
- Use
dpkg -r
to remove the deb.
- 安装检查安装
- 使用 checkinstall 对 Python 安装进行 deb
- 使用
dpkg -r
删除DEB。
See this postfor more details.
有关更多详细信息,请参阅此帖子。
PS. Note that Ubuntu must always have at least one installation of Python installed, or else major pieces of your OS stop working. Above, I'm assuming it's safe to remove the Python built from source, without removing the Python that was installed by the package manager.
附注。请注意,Ubuntu 必须始终至少安装一个 Python,否则操作系统的主要部分将停止工作。上面,我假设删除从源代码构建的 Python 是安全的,而不删除由包管理器安装的 Python。
PPS. If you accidentally erase all Python installations from your Ubuntu machine, all is not lost. Instructions on how to recover from this situation can be found here.
聚苯乙烯。如果你不小心从你的 Ubuntu 机器上删除了所有的 Python 安装,一切都不会丢失。可以在此处找到有关如何从这种情况中恢复的说明。
回答by Julio
Have you looked into make uninstall I believe this should work for you, assuming you have the python 2.6 source and the make file has uninstall available (it should).
你有没有研究过 make uninstall 我相信这应该适合你,假设你有 python 2.6 源代码并且 make 文件有卸载可用(它应该)。
回答by ewall
Do you still have the source directory where you compiled Python before? If so, you can CD into that directory and run sudo make uninstall
.
之前编译Python的源码目录还在吗?如果是这样,您可以 CD 进入该目录并运行sudo make uninstall
.
If you don't have it still, you could re-create it by going through the build steps again--download, extract, configure, and make--but end with sudo make uninstall
instead of sudo make install
, of course.
如果您仍然没有它,您可以通过再次执行构建步骤来重新创建它——下载、解压缩、配置和制作——但当然以sudo make uninstall
而不是结束sudo make install
。
回答by maletor
In the future it may be prudent to use sudo checkinstall
.
将来使用sudo checkinstall
.
回答by paulsm4
"make uninstall" is your best bet. Unfortunately, it sounds like your particular source install doesn't have an "uninsall" target. Drag :(
"setup.py uninstall" is another good suggestion. Please post back if you have it, and if it worked. Unfortunately, it, too, might not exist with your particular source install.
Failing all else, a "brute force" method would be:
a) dpkg -l # Find out the exact version of your Python package
dpkg -L YOUR_PYTHON_PACKAGE_AND_VERSION # Get a list of all files in the package
b) cd YOUR_PYTHON_SOURCE
./configure
make clean
make install # Get a list of all files in the source install
c) dpkg -r YOUR_PYTHON_PACKAGE_AND_VERSION # Remove the package
d) Go on a search-and-destroy mission for all files you identified in steps a) and b)
e) Reinstall from package (recommended) or source
f) Voila! Done.
“卸载”是你最好的选择。不幸的是,听起来您的特定源安装没有“uninsall”目标。拖 :(
“setup.py uninstall”是另一个好建议。如果你有它,如果它有效,请回帖。不幸的是,它也可能不存在于您的特定源安装中。
否则,“蛮力”方法将是:
a) dpkg -l # 找出你的 Python 包的确切版本
dpkg -L YOUR_PYTHON_PACKAGE_AND_VERSION # 获取包中所有文件的列表
b) cd YOUR_PYTHON_SOURCE
。/配置
清洁
make install # 获取源安装中所有文件的列表
c) dpkg -r YOUR_PYTHON_PACKAGE_AND_VERSION # 删除包
d) 对您在步骤 a) 和 b) 中识别的所有文件进行搜索和销毁任务
e) 从包(推荐)或源重新安装
f) 瞧!完毕。
'Hope that helps .. PSM
'希望有帮助.. PSM
回答by ExploringApple
Below command removed all the things it installed for me.
下面的命令删除了它为我安装的所有东西。
make -n install