簡體   English   中英

為python 2.7 windows 10安裝pip命令時出現屬性錯誤

[英]Attribute error while installing pip command for python 2.7 windows 10

我正在嘗試使用以下命令安裝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並添加到PATH中。 當我在控制台上鍵入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.

您的Python 2.7安裝似乎被扭曲:模塊collections包含帶有f'' string的代碼,該代碼僅適用於Python 3。

我的建議是重新安裝Python 2.7。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM