2015-06-11 84 views
0

安裝:Windows 7的 的Python:3.4.3 VIRTUALENV:13.0.3 PIP:7.0.3的Python 3.4.3的virtualenv錯誤代碼2

我試圖建立一個virtualenv中對微軟Windows 7,但我得到以下錯誤:

C:\test>virtualenv venv 

    Using base prefix 'C:\\Python34' 
    New python executable in venv\Scripts\python.EXE 
    Installing setuptools, pip, wheel... 
     Complete output from command C:\test\venv\Scripts\python.EXE -c "import sys, p 
    ip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel: 
     Ignoring indexes: https://pypi.python.org/simple 
    Collecting setuptools 
    Exception: 
    Traceback (most recent call last): 
     File "C:\Python34\lib\site-packages\virtualenv_support\pip-7.0.3-py2.py3-none- 
    any.whl\pip\basecommand.py", line 223, in main 
     status = self.run(options, args) 
     File "C:\Python34\lib\site-packages\virtualenv_support\pip-7.0.3-py2.py3-none- 
    any.whl\pip\commands\install.py", line 280, in run 
     requirement_set.prepare_files(finder) 
     File "C:\Python34\lib\site-packages\virtualenv_support\pip-7.0.3-py2.py3-none- 
    any.whl\pip\req\req_set.py", line 317, in prepare_files 
     functools.partial(self._prepare_file, finder)) 
     File "C:\Python34\lib\site-packages\virtualenv_support\pip-7.0.3-py2.py3-none- 
    any.whl\pip\req\req_set.py", line 304, in _walk_req_to_install 
     more_reqs = handler(req_to_install) 
     File "C:\Python34\lib\site-packages\virtualenv_support\pip-7.0.3-py2.py3-none- 
    any.whl\pip\req\req_set.py", line 439, in _prepare_file 
     req_to_install.populate_link(finder, self.upgrade) 
     File "C:\Python34\lib\site-packages\virtualenv_support\pip-7.0.3-py2.py3-none- 
    any.whl\pip\req\req_install.py", line 244, in populate_link 
     self.link = finder.find_requirement(self, upgrade) 
     File "C:\Python34\lib\site-packages\virtualenv_support\pip-7.0.3-py2.py3-none- 
    any.whl\pip\index.py", line 486, in find_requirement 
     all_versions = self._find_all_versions(req.name) 
     File "C:\Python34\lib\site-packages\virtualenv_support\pip-7.0.3-py2.py3-none- 
    any.whl\pip\index.py", line 407, in _find_all_versions 
     self.find_links, expand_dir=True) 
     File "C:\Python34\lib\site-packages\virtualenv_support\pip-7.0.3-py2.py3-none- 
    any.whl\pip\index.py", line 234, in _sort_locations 
     sort_path(os.path.join(path, item)) 
     File "C:\Python34\lib\site-packages\virtualenv_support\pip-7.0.3-py2.py3-none- 
    any.whl\pip\index.py", line 215, in sort_path 
     if mimetypes.guess_type(url, strict=False)[0] == 'text/html': 
     File "C:\Python34\Lib\mimetypes.py", line 287, in guess_type 
     init() 
     File "C:\Python34\Lib\mimetypes.py", line 348, in init 
     db.read_windows_registry() 
     File "C:\Python34\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 

    ---------------------------------------- 
    ...Installing setuptools, pip, wheel...done. 
    Traceback (most recent call last): 
     File "C:\Python34\lib\runpy.py", line 170, in _run_module_as_main 
     "__main__", mod_spec) 
     File "C:\Python34\lib\runpy.py", line 85, in _run_code 
     exec(code, run_globals) 
     File "C:\Python34\Scripts\virtualenv.exe\__main__.py", line 9, in <module> 
     File "C:\Python34\lib\site-packages\virtualenv.py", line 832, in main 
     symlink=options.symlink) 
     File "C:\Python34\lib\site-packages\virtualenv.py", line 1004, in create_envir 
    onment 
     install_wheel(to_install, py_executable, search_dirs) 
     File "C:\Python34\lib\site-packages\virtualenv.py", line 969, in install_wheel 

     'PIP_NO_INDEX': '1' 
     File "C:\Python34\lib\site-packages\virtualenv.py", line 910, in call_subproce 
    ss 
     % (cmd_desc, proc.returncode)) 
    OSError: Command C:\test\venv\Scripts\python.EXE -c "import sys, pip; sys...d\"] 
    + sys.argv[1:]))" setuptools pip wheel failed with error code 2 

    C:\test> 

我已經搜索了很多,但沒有找到解決方案,解決了我的問題。希望有人能幫助。

+1

難道是這個問題的副本兔子洞修復? http://stackoverflow.com/questions/2384064/python-winreg-problem –

+0

如果是這樣,安裝pywin32/Build 219似乎沒有解決這個問題。 –

+0

我無法訪問Windows機器,否則我可以運行它來查看是否發生相同的錯誤。祝你好運! –

回答

0

這是Python 3.4.3安裝程序中的一個錯誤,它被認爲是固定的。我重新下載並重新安裝了Python,但無濟於事。

我設法找到其遵循了只涉及修改一個文件mimetypes.py

https://hg.python.org/cpython/rev/bf2016a1911f