[英]AttributeError: 'module' object has no attribute 'python_implementation' running pip
I installed Cygwin with Python set-up tools.我使用 Python 设置工具安装了 Cygwin。 When I try to run pip install
awscli
I get the following error:当我尝试运行 pip install
awscli
,出现以下错误:
$ pip install awscli
Traceback (most recent call last):
File "/usr/bin/pip", line 8, in <module>
load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
File "build/bdist.linux-i686/egg/pkg_resources.py", line 318, in load_entry_point
File "build/bdist.linux-i686/egg/pkg_resources.py", line 2221, in load_entry_point
File "build/bdist.linux-i686/egg/pkg_resources.py", line 1954, in load
File "/usr/lib/python2.5/site-packages/pip-1.5.4-py2.5.egg/pip/__init__.py", line 9, in <module>
from pip.log import logger
File "/usr/lib/python2.5/site-packages/pip-1.5.4-py2.5.egg/pip/log.py", line 9, in <module>
from pip._vendor import colorama, pkg_resources
File "/usr/lib/python2.5/site-packages/pip-1.5.4-py2.5.egg/pip/_vendor/pkg_resources.py", line 1112, in <module>
class MarkerEvaluation(object):
File "/usr/lib/python2.5/site-packages/pip-1.5.4-py2.5.egg/pip/_vendor/pkg_resources.py", line 1120, in MarkerEvaluation
'python_implementation': platform.python_implementation,
AttributeError: 'module' object has no attribute 'python_implementation'
Am I missing something in my path or is my Python implementation hosed?我在我的路径中遗漏了什么还是我的 Python 实现被灌输了?
Do you have a folder called "/platform" inside your python app?你的python应用程序中有一个名为“/platform”的文件夹吗?
If you do, it will scope-shadow the native python "platform" module.如果你这样做,它将作用域阴影原生 python“平台”模块。 When modules you're using try to get information about the system, they'll get a null object back.
当您使用的模块尝试获取有关系统的信息时,它们将返回一个空对象。 This will often cause errors like:
这通常会导致以下错误:
AttributeError: 'module' object has no attribute 'version'
AttributeError: 'module' object has no attribute 'machine'
AttributeError: 'module' object has no attribute 'python_implementation'
Simply rename the "/platform" folder to something else to resolve the problem.只需将“/platform”文件夹重命名为其他名称即可解决问题。
重新安装pip
可能会修复它,尝试使用easy_install
:
sudo easy_install pip
Do you have a folder called "/platform" inside your python app?你的python应用程序中有一个名为“/platform”的文件夹吗? GOT THE POINT!
明白了! I remove my own platform.py, it still not work.
我删除了我自己的platform.py,它仍然不起作用。 later i remove the remained platform.pyc ,it worked!
后来我删除了剩下的 platform.pyc ,它起作用了!
I got this error when my .virtualenvs folder for a linux (fedora) system was symlinked to a Network shared drive (on a Windows server).当我用于 linux (fedora) 系统的 .virtualenvs 文件夹符号链接到网络共享驱动器(在 Windows 服务器上)时,我收到此错误。 Upgrading the system pip
升级系统pip
sudo pip install --upgrade pip
And then creating a new ~/.virtualenvs/ locally with a fresh virtualenv did the trick for me.然后使用新的 virtualenv 在本地创建一个新的 ~/.virtualenvs/ 对我有用。
Similar to what others have posted, I got the same error from having a platform.py file (rather than directory).与其他人发布的内容类似,我从拥有 platform.py 文件(而不是目录)中得到了同样的错误。 I renamed it and the error went.
我重命名了它,错误消失了。
I'll add another name to the list: I had a script named profile.py
in the startup directory that was causing the same problem.我将在列表中添加另一个名称:我在启动目录中有一个名为
profile.py
的脚本导致了同样的问题。
Strangely enough, I thought I might have had a file called platform.py
in the directory.奇怪的是,我以为目录中可能有一个名为
platform.py
的文件。 I use Python in the manufacture of turbine blades, which have features we call 'platforms'.我在涡轮叶片的制造中使用 Python,它具有我们称为“平台”的功能。 They also have a 'profile' (the airfoil leading edge profile, to be exact), and when I saw
profile.py
a light bulb went off, as I was aware of Python's 'profile' module from the Standard Library.它们还有一个“轮廓”(准确地说是翼型前缘轮廓),当我看到
profile.py
一个灯泡熄灭了,因为我知道标准库中的 Python 的“轮廓”模块。
Funny how this never came up before - I've been using IPython since ~Python2.7.9, and there wasn't even a problem back in the 3.6 days (I'm upgrading to 3.8.6).有趣的是,以前从未出现过这种情况 - 我从 ~Python2.7.9 开始就一直在使用 IPython,并且在 3.6 天内甚至没有出现问题(我正在升级到 3.8.6)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.