python3.x安装setuptool出现openkey() argument 2 must...解决方法

来源:互联网 发布:深圳海关数据 编辑:程序博客网 时间:2024/06/03 18:32

我的python3.4.1安装setuptool的时候出现了像这样的错误

Traceback (most recent call last):  File "setup.py", line 17, in <module>    exec(init_file.read(), command_ns)  File "<string>", line 8, in <module>  File "C:\Users\tim\Desktop\setuptools-2.0.2\setuptools\__init__.py", line 11, in <module>    from setuptools.extension import Extension  File "C:\Users\tim\Desktop\setuptools-2.0.2\setuptools\extension.py", line 5, in <module>    from setuptools.dist import _get_unpatched  File "C:\Users\tim\Desktop\setuptools-2.0.2\setuptools\dist.py", line 15, in <module>    from setuptools.compat import numeric_types, basestring  File "C:\Users\tim\Desktop\setuptools-2.0.2\setuptools\compat.py", line 49, in <module>    from http.server import HTTPServer, SimpleHTTPRequestHandler  File "C:\Python\lib\http\server.py", line 654, in <module>    class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):  File "C:\Python\lib\http\server.py", line 839, in SimpleHTTPRequestHandler    mimetypes.init() # try to read system mime.types  File "C:\Python\lib\mimetypes.py", line 348, in init    db.read_windows_registry()  File "C:\Python\lib\mimetypes.py", line 255, in read_windows_registry    with _winreg.OpenKey(hkcr, subkeyname) as subkey:TypeError: OpenKey() argument 2 must be str without null characters or None, not str

可以看到出现错误的文件是mimetypes.py这个

我的解决方法就是下载个python2.7,然后,将里面的mimetypes.py替换掉python3.4的mimetypes.py,然后稍微改改让它的语法通过,然后就安装成功了哈哈。

这个是我修改后的mimetypes.py可以在python3.x用的文件,替换前记得先备份该文件

下载地址:http://pan.baidu.com/s/1qWuK4lY

0 0
原创粉丝点击