尝试安装PIP时出现奇怪的错误

时间:2016-12-17 22:16:00

标签: python python-2.7 windows-7 pip

尝试安装PIP。 我在Windows 7(32位)上安装了python 2.7

我按照此处的说明创建了一个名为 get-pip.py 的文件:https://pip.pypa.io/en/stable/installing/ 当我用python运行该文件时,我收到以下错误。用户帐户具有管理员权限。

有谁知道发生了什么事?

C:\Python27>python get-pip.py
Traceback (most recent call last):
  File "get-pip.py", line 20061, in <module>
    main()
  File "get-pip.py", line 194, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
    import pip
  File "c:\users\sek~1.sek\appdata\local\temp\tmpvkex0l\pip.zip\pip\__init__.py", line 21, in <module>
  File "c:\users\sek~1.sek\appdata\local\temp\tmpvkex0l\pip.zip\pip\_vendor\requests\__init__.py", line 62, in <module>
  File "c:\users\sek~1.sek\appdata\local\temp\tmpvkex0l\pip.zip\pip\_vendor\requests\packages\__init__.py", line 27, in <module>
  File "c:\users\sek~1.sek\appdata\local\temp\tmpvkex0l\pip.zip\pip\_vendor\requests\packages\urllib3\__init__.py", line 8, in <module>
  File "c:\users\sek~1.sek\appdata\local\temp\tmpvkex0l\pip.zip\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 41, in <module>
  File "c:\users\sek~1.sek\appdata\local\temp\tmpvkex0l\pip.zip\pip\_vendor\requests\packages\urllib3\request.py", line 7, in <module>
  File "c:\users\sek~1.sek\appdata\local\temp\tmpvkex0l\pip.zip\pip\_vendor\requests\packages\urllib3\filepost.py", line 9, in <module>
  File "c:\users\sek~1.sek\appdata\local\temp\tmpvkex0l\pip.zip\pip\_vendor\requests\packages\urllib3\fields.py", line 2, in <module>
  File "C:\Python27\lib\email\utils.py", line 313
    fallback charset='us-ascii'):
                   ^
SyntaxError: invalid syntax

C:\Python27>

1 个答案:

答案 0 :(得分:0)

  

<强> Do I need to install pip?

     如果您正在使用从 Python 2&gt; = 2.7.9 Python 3&gt; = 3.4 下载的二进制文件,则已安装

pip python.org,但你需要升级pip。

只需将pip添加到您的环境路径:

<python install dir>/Scripts/

使用提升的命令提示符可以轻松完成:

setx path "%path%;<python install dir>/Scripts/"

然后,升级它:

python -m pip install -U pip