[英]Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
Long story short, I did a pip upgrade and a command that told it to install a bunch of dependencies in one file, and now when i try to do anything with pip, it is throwing me长话短说,我做了一个 pip 升级和一个命令告诉它在一个文件中安装一堆依赖项,现在当我尝试用 pip 做任何事情时,它把我扔了
For example, running例如,运行
py -m pip -V
throws投掷
Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
Along with anything else that involves my trying to call my python 3.8 pip.连同其他任何涉及我试图调用我的 python 3.8 pip 的事情。
Running跑步
py -m ensurepip
Tells me that pip is infact installed.告诉我 pip 已安装。
Requirement already satisfied: setuptools in c:\program files (x86)\python38-32\lib\site-packages (60.3.0)
Requirement already satisfied: pip in c:\program files (x86)\python38-32\lib\site-packages (21.3.1)
Which covers the pip not installed, and module not installed case that similar questions appear to be solved by.其中涵盖了 pip 未安装和模块未安装的情况,类似的问题似乎可以解决。 So, does anyone have any idea what is going on and how to get pip to start working again as a module?那么,有没有人知道发生了什么以及如何让 pip 作为模块重新开始工作?
This is a bug with setuptools .这是 setuptools 的一个错误。 Version 60.3.0 has been yanked from PyPI, which I believe resolves the issue once you run another upgrade.版本 60.3.0 已从PyPI 中删除,我相信一旦您运行另一次升级,它就可以解决问题。 (I wasn't hit by it myself.) If not, GitHub user ferrants suggested this workaround : (我自己并没有被它击中。)如果没有,GitHub 用户ferrants建议这种解决方法:
python3 -m pip install --upgrade setuptools==60.2.0
Disclaimer: I haven't tried this myself, but it looks fine.免责声明:我自己没有尝试过,但看起来不错。
Thanks, and I need use "pip3 install --upgrade setuptools==60.2.0".谢谢,我需要使用“pip3 install --upgrade setuptools==60.2.0”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.