使用 pip 安装/卸载我的模块
我正在阅读《Learn Python the Hard Way, 2nd Edition》一书,我遇到了这个问题:“使用你的 setup.py 安装你自己的模块并确保它可以工作,然后使用 pip卸载它。”
如果我
setup.py install
在命令行中输入,我就可以安装该模块。
但是当我输入
pip uninstall setup.py
它时,它说:
Cannot uninstall requirement setup.py, not installed
pip 包索引说, http://pypi.python.org/pypi/pip ,说:
pip 能够使用 pip uninstall package-name 卸载大多数已安装的软件包。
已知的例外情况包括使用 python setup.py install 安装的 pure-distutils 软件包(此类软件包不会留下任何元数据,允许确定安装了哪些文件)
是否有另一种方法来安装 pip 可以识别的模块?
顺便说一句,我使用的是 Windows 电脑。只是想提一下,如果 Windows、Linux 和 Mac 有不同的解决方案。
I am going through the Learn Python the Hard Way, 2nd Edition book, and I am stuck on this problem: "Use your setup.py to install your own module and make sure it works, then use pip to uninstall it."
If I type
setup.py install
in the command line, I can install the module.
But when I type
pip uninstall setup.py
it says:
Cannot uninstall requirement setup.py, not installed
The pip package index says, http://pypi.python.org/pypi/pip, says:
pip is able to uninstall most installed packages with pip uninstall package-name.
Known exceptions include pure-distutils packages installed with python setup.py install >(such packages leave behind no metadata allowing determination of what files were >installed)
Is there another way to install my module that pip will recognize?
By the way, I'm using a windows computer. Just wanted to mention that in case there are different solutions for Windows, Linux, and Mac.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你给 pip 一个 Python 文件而不是包名,所以它不知道要做什么。如果您希望 pip 删除它,请尝试提供此 setup.py 文件实际所属的包的名称。
此相关主题中有一些很好的建议:
python setup.py 卸载
You're giving pip a Python file and not a package name, so it doesn't know what to do. If you want pip to remove it, try providing the name of the package this setup.py file is actually part of.
There are some good suggestions in this related thread:
python setup.py uninstall