请教一个pip install 出现报asciii码错误的问题
来源:互联网 发布:留守儿童犯罪率数据 编辑:程序博客网 时间:2024/05/16 11:39
转载:http://www.v2ex.com/t/90659
系统版本:win8.1 x64
python版本:2.7.5pip版本:pip-1.4.1
异常如下:
---------------------------------------------------------------------------------------------------------
>pip install sh
Downloading/unpacking sh
Cleaning up...
Exception:
Traceback (most recent call last):
File "D:\developer\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\basecomm
and.py", line 134, in main
status = self.run(options, args)
File "D:\developer\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\commands
\install.py", line 236, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundl
e=self.bundle)
File "D:\developer\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\req.py",
line 1092, in prepare_files
self.unpack_url(url, location, self.is_download)
File "D:\developer\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\req.py",
line 1238, in unpack_url
retval = unpack_http_url(link, location, self.download_cache, self.download_
dir)
File "D:\developer\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\download
.py", line 621, in unpack_http_url
temp_location = os.path.join(temp_dir, filename)
File "D:\developer\Python27\lib\ntpath.py", line 108, in join
path += "\\" + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb1 in position 9: ordinal
not in range(128)
Traceback (most recent call last):
File "D:\developer\Python27\Scripts\pip-script.py", line 9, in <module>
load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
File "D:\developer\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\__init__
.py", line 148, in main
return command.main(args[1:], options)
File "D:\developer\Python27\lib\site-packages\pip-1.4.1-py2.7.egg\pip\basecomm
and.py", line 169, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb1 in position 34: ordinal
not in range(128)
-------------------------------------------------------------------------------------------------------
不知道是什么原因,以前pip是好使的。突然有一天我兴致冲冲地想用一下python就出现这个问题了。不止是安装sh,安装Django,安装任何包都出现这个问题安装不了,网上搜也搜不出答案,所以只好把问题贴在这求大神们指教。
附上解决方法:
原因是pip安装python包会加载我的用户目录,我的用户目录恰好是中文的,ascii不能编码。解决办法是:
python目录 Python27\Lib\site-packages 建一个文件sitecustomize.py
内容写:
import sys
sys.setdefaultencoding('gb2312')
python会自动运行这个文件。
0 0
- 请教一个pip install 出现报asciii码错误的问题
- pip install 出现报asciii码错误的问题
- pip install 出现报asciii码错误的问题
- pip install 出现报asciii码错误的问题
- pip install 出现报asciii码错误的问题
- pip install 出现报asciii码错误的问题
- pip install 出现报asciii码错误的问题
- pip install 出现报asciii码错误的解决方案
- windows下pip install 出现报asciii码错误的问题
- Python&pip install中出现的asciii码错误的问题
- pip install 出现报UnicodeEncodeError错误的问题
- Python pip install出现报ASCII码错误解决办法
- pip install pysftp出现的错误
- pip install polyglot 出现的问题总结
- python中尝试pip install PIL,出现错误的解决方法
- Linux下pip install 出现ascii编码问题的解决方法
- 执行pip install 出现编码错误,UnicodeEncodeError:.....
- Windows下pip install wordcloud出现问题
- [从头学数学] 第50节 复式统计表
- 注册时手机验证用户
- sql语句中case-when用法
- 浅析Java中CountDownLatch用法
- ejb injection
- 请教一个pip install 出现报asciii码错误的问题
- UVA 18451 阅读题
- Android中下拉刷新和加载更多的实现方式
- 【WC2002】奶牛浴场
- java自带线程池和队列详细讲解
- 2016.01.17—-即便没有读者,你也要写博客
- zookeeper原理(转)
- POJ 2777 Count Color(线段树区间修改+位运算)
- 鸟瞰“网站服务器怎么工作?”