简体   繁体   中英

Why doesn't pip work?

I have installed pip and everything based off of this video, and the install seemed to look great. But when I say "import pip" in IDLE, I get this error:

  Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
  import pip
File "C:\Python33\lib\site-packages\pip\__init__.py", line 9, in <module>
  from pip.log import logger
File "C:\Python33\lib\site-packages\pip\log.py", line 8, in <module>
  from pip import backwardcompat
File "C:\Python33\lib\site-packages\pip\backwardcompat\__init__.py", line 27, in <module>
 console_encoding = sys.__stdout__.encoding
AttributeError: 'NoneType' object has no attribute 'encoding'

What did I do wrong?

You don't import pip from within IDLE, you are supposed to call it from the command line. It is expecting there to be a stdout, but it looks like there is not one from within IDLE.

curl https://bootstrap.pypa.io/get-pip.py | python -

尝试上面的命令,它将从PyPy获取PIP的最新代码。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM