简体   繁体   English

查找“pip”的模块规范时出错(AttributeError:模块“__main__”没有属性“__file__”)

[英]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.

相关问题 如何修复 pip 错误“查找 'pip' 的模块规范时出错(AttributeError:模块 '__main__' 没有属性 '__file__')”? - How to fix pip error "Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')"? Google 应用引擎部署失败 - 查找“pip”的模块规范时出错(AttributeError:模块“__main__”没有属性“__file__”) - Google app engine deployment fails- Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__') AttributeError: 模块 '__main__' 没有属性 'AverageWordLengthExtractor' - AttributeError: module '__main__' has no attribute 'AverageWordLengthExtractor' AttributeError:模块'__main__'没有属性'cleaner' - AttributeError: module '__main__' has no attribute 'cleaner' AttributeError:模块“ Tkinter”没有属性“ __file__” - AttributeError: module 'Tkinter' has no attribute '__file__' AttributeError:'module'对象没有属性'__file__'(使用pip安装自己的模块) - AttributeError: 'module' object has no attribute '__file__' (own module installed using pip) AttributeError: 模块 Pip 没有属性“main” - AttributeError: Module Pip has no attribute 'main' unittest:AttributeError:模块'__main__'没有属性'C:\ ...' - unittest: AttributeError: module '__main__' has no attribute 'C:\…' pickle/joblib AttributeError: 模块 '__main__' 在 pytest 中没有属性 'thing' - pickle/joblib AttributeError: module '__main__' has no attribute 'thing' in pytest Python多处理错误:AttributeError:模块'__main__'没有属性'__spec__' - Python Multiprocessing error: AttributeError: module '__main__' has no attribute '__spec__'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM