UnicodeDecodeError
错误信息:
<span style="font-family:Consolas, Courier New, Courier, mono, serif;"><span style="background-color: rgb(248, 248, 248);"></span></span><pre name="code" class="plain">UnicodeDecodeError: 'ascii' codec can't decode byte 0xcb in position 0: ordinal not in range(128)
报错信息已经说明是Unicode字符的问题。pip安装python包时加载用户目录,Windows下的环境编码为GBK,ascii无法编码。
解决方案:
在python安装目录 Python27\Lib\site-packages 建一个文件sitecustomize.py,内容为
import sys
sys.setdefaultencoding('gb2312')
只管运行“pip install package”,python会自动运行这个文件。
ConnectionError
Exception information:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Python34\lib\site-packages\pip\commands\install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "C:\Python27\lib\site-packages\pip\req.py", line 1177, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "C:\Python34\lib\site-packages\pip\index.py", line 277, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
pip.exceptions.DistributionNotFound: No distributions at all found for linkchecker
墙的问题($_$),
网上有挺多可用的源的,比如豆瓣:http://pypi.douban.com/simple/, 清华:https://pypi.tuna.tsinghua.edu.cn/simple
Windows下解决方案:
最简单粗暴的办法就是在C:\User\youname\pip目录下新建文件pip.ini,内容写上
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
其他问题看提示信息就能明白的就不写了。所以好像跟标题有点不符额呵呵。。。