我正在尝试使用以下命令安装pip:
$python get-pip.py
但是,会得到以下错误。我尝试了其他用户提出的关于属性错误的解决方案,但都不起作用。
Traceback (most recent call last):
File "get-pip.py", line 25, in <module>
import shutil
File "C:\Python27\lib\shutil.py", line 12, in <module>
import collections
File "C:\Python27\lib\collections\__init__.py", line 55
raise AttributeError(f'module {__name__!r} has no attribute {name!r}')我安装了正确版本的python,并将其添加到路径中。当我在控制台上输入python时,我得到以下输出:
Python 2.7.16 (v2.7.16:413a49145e, Mar 4 2019, 01:37:19) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.发布于 2019-05-10 05:51:40
您的Python2.7安装似乎被扭曲了:f'' collections包含的代码带有只能与Python3一起使用的模块-string。
我的建议是重新安装Python 2.7。
https://stackoverflow.com/questions/56067829
复制相似问题