VirtualEnv:在Win 7中创建虚拟环境失败

时间:2014-09-17 16:44:40

标签: python django python-2.7

刚刚在我的Windows 7盒子上安装了python,pip和virtualenv。

当我想创建虚拟环境时,请进入以下问题:

virtualenv测试给了我:

------------------------------------------------------------
-c run on 09/18/14 00:24:25

Ignoring indexes: https://pypi.python.org/simple/

Downloading/unpacking setuptools

Cleaning up...

Removing temporary dir C:\Users\Han\test\build...

Exception:

Traceback (most recent call last):

File "c:\python27\lib\site-packages\virtualenv_support\pip-1.5.6-py2.py3-none-any.whl\pip\basecommand.py", line 122, in main
    status = self.run(options, args)

File "c:\python27\lib\site-packages\virtualenv_support\pip-1.5.6-py2.py3-none-any.whl\pip\commands\install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)

File "c:\python27\lib\site-packages\virtualenv_support\pip-1.5.6-py2.py3-none-any.whl\pip\req.py", line 1177, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)

File "c:\python27\lib\site-packages\virtualenv_support\pip-1.5.6-py2.py3-none-any.whl\pip\index.py", line 209, in find_requirement
    file_locations, url_locations = self._sort_locations(locations)

File "c:\python27\lib\site-packages\virtualenv_support\pip-1.5.6-py2.py3-none-any.whl\pip\index.py", line 128, in _sort_locations
    sort_path(os.path.join(path, item))

File "c:\python27\lib\site-packages\virtualenv_support\pip-1.5.6-py2.py3-none-any.whl\pip\index.py", line 109, in sort_path
    if mimetypes.guess_type(url, strict=False)[0] == 'text/html':

File "c:\python27\Lib\mimetypes.py", line 287, in guess_type
    init()

File "c:\python27\Lib\mimetypes.py", line 348, in init
    db.read_windows_registry()

File "c:\python27\Lib\mimetypes.py", line 256, in read_windows_registry
    with _winreg.OpenKey(hkcr, subkeyname) as subkey:
WindowsError: [Error 2] The system cannot find the file specified

任何想法?尝试过使用注册表检查程序以及对mimetypes.py文件进行硬编码:http://www.swarley.me.uk/blog/2014/04/23/python-pip-and-windows-registry-corruption/但仍然会出现同样的错误。

1 个答案:

答案 0 :(得分:0)

您从read_windows_registry()功能获取的不同特定错误消息比my blog post中我所谈到的消息更多,因此我不认为删除/跳过已损坏的注册表项空字符对你有效。

我刚刚在 virtualenv 项目中找到issue #505,这似乎是在讨论您的具体问题。该线程中有几个建议 - 这些建议可以解决您的问题吗?看起来问题随后由pull request #579修复,所以也许你只需要更新到 virtualenv 的更新版本?