Python 如果从源代码安装,如何卸载包管理器“pip”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18546321/
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
How do you uninstall the package manager "pip", if installed from source?
提问by D.C. Rockwell
I was unaware that pip could be installed via my operating system's package manager, so I compiled and installed pip via source with the following command:
我不知道可以通过操作系统的包管理器安装 pip,所以我使用以下命令通过源代码编译并安装了 pip:
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | sudo python
I would like to uninstall pip, and instead install it from my operating system's package manager. How would I go about completely undoing the work of the installation script?
我想卸载 pip,而是从我的操作系统的包管理器中安装它。我将如何完全撤消安装脚本的工作?
采纳答案by Viktor Kerkez
That way you haven't installed pip, you installed just the easy_install
i.e. setuptools
.
这样你就没有安装 pip,你只安装了easy_install
ie setuptools
。
First you should remove all the packages you installed with easy_install
using (see uninstall):
首先,您应该删除easy_install
使用安装的所有软件包(请参阅卸载):
easy_install -m PackageName
This includes pip
if you installed it using easy_install pip
.
这包括pip
如果您使用easy_install pip
.
After this you remove the setuptools
following the instructions from here:
在此之后,您setuptools
从此处删除以下说明:
If setuptools package is found in your global site-packages directory, you may safely remove the following file/directory:
如果在您的全局站点包目录中找到 setuptools 包,您可以安全地删除以下文件/目录:
setuptools-*.egg
If setuptools is installed in some other location such as the user site directory (eg: ~/.local, ~/Library/Python or %APPDATA%), then you may safely remove the following files:
如果 setuptools 安装在其他位置,例如用户站点目录(例如:~/.local、~/Library/Python 或 %APPDATA%),那么您可以安全地删除以下文件:
pkg_resources.py
easy_install.py
setuptools/
setuptools-*.egg-info/
回答by Karthikeyan D
pip uninstall pip
will work
pip uninstall pip
将工作
回答by Deepak Kumar
I was using above command but it was not working. This command worked for me:
我正在使用上面的命令,但它不起作用。这个命令对我有用:
python -m pip uninstall pip setuptools
回答by vincedjango
If you installed pip like this:
如果您像这样安装了 pip:
- sudo apt install python-pip
- sudo apt install python3-pip
Uninstall them like this:
像这样卸载它们:
- sudo apt remove python-pip
- sudo apt remove python3-pip