安装python失败的方法_python安装easy_install失败的解决办法

系统:win7 64位

python:版本2.7.6

报错信息:

Traceback (most recent call last):

File "c:\docume~1\admini~1\locals~1\temp\tmpbg7qjrpycharm-management\setuptools-1.1.5\setup.py", line 17, in

exec(init_file.read(), command_ns)

File "", line 8, in

File "c:\docume~1\admini~1\locals~1\temp\tmpbg7qjrpycharm-management\setuptools-1.1.5\setuptools\__init__.py", line 11, in

from setuptools.extension import Extension

......

File "C:\Python27\lib\mimetypes.py", line 258, in read_windows_registry

for subkeyname in enum_types(hkcr):

File "C:\Python27\lib\mimetypes.py", line 249, in enum_types

ctype = ctype.encode(default_encoding) # omit in 3.x!

UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 9: ordinal not in range(128)

解决办法:

在python安装目录Lib的mimetypes.py中,

default_encoding = sys.getdefaultencoding()

这句之前加上设置默认编码,添加如下语句:

reload(sys)

sys.setdefaultencoding("cp936")

参考链接:文章传送门

------------update------------------

用上述办法后,如果你要使用easy_install安装python的第三方模块,千万不能删除上述语句。

如果删除上述语句后,将会报错如下:

ctype = ctype.encode(default_encoding) # omit in 3.x!

UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 1: ordinalnot in range(128)

还是编码问题。所以暂时还不能删掉上述语句,如果插入的语句影响到你功能开发,那就先注释掉;要用easy_install安装第三方模块再恢复。(刚刚入门的python菜鸟想到的办法 stQ

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值