我已根据this视频安装了pip和所有内容,并且安装看起来很棒。但是当我在IDLE中说“import pip”时,我收到了这个错误:
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'
我做错了什么?
答案 0 :(得分:5)
你不从IDLE中导入pip,你应该从命令行调用它。它期待有一个stdout,但看起来IDLE中没有一个。
答案 1 :(得分:0)
curl https://bootstrap.pypa.io/get-pip.py | python -
尝试Above命令,从PyPy获取PIP的最新代码。