python pip installl flexget 时遇到的问题,求教各位专家

2160人阅读
python(65)
我在用pip安装一些第三方库时,总会报错,错误如下:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb1 inposition 34: ordinal
not in range(128)
ascii编码不能解码问题,查了好久,纠结了好久,终于找出问题所在了。。。。。。答案在下面!
&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_
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'tdecode 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 inposition 34: ordinal
not in range(128)
原因是pip安装python包会加载我的用户目录,我的用户目录恰好是中文的,ascii不能编码。
解决办法是:&
python目录 Python27\Lib\site-packages 建一个文件sitecustomize.py&
import sys&
sys.setdefaultencoding('gbk')&
python会自动运行这个文件。
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:182563次
积分:4258
积分:4258
排名:第6707名
原创:222篇
转载:183篇
评论:24条
(4)(3)(22)(2)(11)(1)(14)(6)(22)(13)(10)(5)(6)(10)(23)(14)(26)(13)(50)(86)(35)(31)4924人阅读
python(12)
背景:之前看过一篇博文写的是python操作mysql数据库的文章,心血来潮向来试试。。然后问题来了。。
闲话少扯,环境,windows64位下,python版本是2.7.11,因为操作数据库需要安装mysql-python,所以直接命令行下,
命令:pip install mysql-python
_mysql.c(42)&:&fatal&error&C1083:&Cannot&open&include&file:&'config-win.h':&No&s
uch&file&or&directory
error:&command&'C:\\Program&Files&(x86)\\Common&Files\\Microsoft\\Visual&C++&for
&Python\\9.0\\VC\\Bin\\cl.exe'&failed&with&exit&status&2
起初以为需要安装VC for python,,,下载后还是不行
后来直接下载源文件mysql for python
命令:python set.py install
还是报错!!!
解决方案:
在这里下载对应文件
因为是我 windows64 位 所以
其他的在上面链接,按照自己的对应版本下载,双击即可
要想验证一下,可以这样做:
命令行下&&&import MySQLdb
直接打印&&&print MySQLdb
&module 'MySQLdb' from 'C:\Python27\lib\site-packages\MySQLdb\__init__.pyc'&
OK!,收工!!
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:21275次
排名:千里之外
原创:39篇
(1)(24)(19)

我要回帖

更多关于 pip install 的文章

 

随机推荐