在 windows 上为 django 开发设置 virtualenv,

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1706989/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 13:25:14  来源:igfitidea点击:

setting up virtualenv for django development on windows,

pythonmysqlwindowsdjangovirtualenv

提问by sjh

Setting up a virtualenv for the first time, when i try to install MySQL-python using

第一次设置 virtualenv,当我尝试使用安装 MySQL-python 时

pip -E <<some virtual env>> install MySQL-python

i get

我明白了

File "setup_windows.py", line 7, in get_config

    serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_key'])

WindowsError: [Error 2] The system cannot find the file specified

I guess virtualenv is stopping python from accessising the windows registry somehow, i have tried running easy_install within the virtualenv with no luck (i assume this does exactly the same thing), copying over the site packages dir from my main python install means that yolk will not see it,

我猜 virtualenv 正在以某种方式阻止 python 访问 Windows 注册表,我尝试在 virtualenv 中运行 easy_install 但没有运气(我认为这完全相同),从我的主要 python 安装复制站点包目录意味着 yolk 将不见,

Does anyone know how i can either cajole this into working, or copy over the files needed for mysql support?

有谁知道我可以如何哄骗它工作,或者复制 mysql 支持所需的文件?

Thanks,

谢谢,

回答by sjh

site.cfg in the same dir as setup.py was looking for the wrong regsitry key, at the end of the file is

与 setup.py 位于同一目录中的 site.cfg 正在寻找错误的注册表项,文件末尾是

# The Windows registry key for MySQL.
# This has to be set for Windows builds to work.
# Only change this if you have a different version.
registry_key = SOFTWARE\MySQL AB\MySQL Server 5.0

I dipped into the registry and found HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB\ and saw i had 5.1 instead,

我进入注册表并找到 HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB\ 并看到我有 5.1,

reporting another error now, but this question is solved at least ;)

现在报告另一个错误,但这个问题至少解决了;)