• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

解决 MySQL

mysql 搞代码 4年前 (2022-01-09) 31次浏览 已收录 0个评论

在 windows 环境安装 MySQL-python-1.2.3b1 遇到错误 ———— C:/TDDOWNLOAD/MySQL-python-1.2.3b1.tar/MySQL-python-1.2.3b1/MySQL-python-1.2.3b1 setup.py Traceback (most recent call last): File “C:/TDDOWNLOAD/MySQL-python-1.2.3b1.tar/MySQL-

在 windows 环境安装 MySQL-python-1.2.3b1 遇到错误

————

C:/TDDOWNLOAD/MySQL-python-1.2.3b1.tar/MySQL-python-1.2.3b1/MySQL-python-1.2.3b1
>setup.py
Traceback (most recent call last):
File “C:/TDDOWNLOAD/MySQL-python-1.2.3b1.tar/MySQL-python-1.2.3b1/MySQL-python
-1.2.3b1/setup.py”, line 15, in
metadata, options = get_config()
File “C:/TDDOWNLOAD/MySQL-python-1.2.3b1.tar/MySQL-python-1.2.3b1/MySQL-python
-1.2.3b1/setup_windows.py”, line 7, in get_config
serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options[‘registry_ke
y’])
WindowsError: [Error 2]

————

WindowsError: [Error 2]

系统找不到指定的文件。

————

google一时没找到说明,找到的两个相关内容也是俄语的,那就看看代码好了:

file “setup_windows.py”, line 7, in get_config

metadata, options = get_metadata_and_options()

serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options[‘registry_key’])
mysql_root, dummy = _winreg.QueryValueEx(serverKey,’Location’)

file “setup_common.py” line 5,8, in get_metadata_and_options

config.read([‘metadata.cfg’, ‘site.cfg’])

options = dict(config.items(‘options’))

file “site.cfg” line 18 in [options]

registry_key = SOFTWARE/MySQL AB/MySQL Server 5.0

很明显,是要找到下面注册表项

HKE

本文来源gaodai^.ma#com搞#代!码网

Y_LOCAL_MACHINE/SOFTWARE/MySQL AB/MySQL Server 5.0

的 Location 键值,而这个键值取出来后就用在后面代码,用来设置 mysql

的 include 目录与 library 目录

file “setup_windows.py”, line 19,21, in get_config

library_dirs = [ os.path.join(mysql_root, r’lib/opt’) ]
include_dirs = [ os.path.join(mysql_root, r’include’) ]

而我机器上的两个mysql一个是 XAMPP 带的,另一个是 mysql-noinstall-5.0.67-win32 都没有写

注册表相应键值。搞清楚了情况,要解决问题就很简单了

然后

setup.py build

setup.py install

测试OK

—————-

MySQL for Python

http://sourceforge.net/projects/mysql-python

MySQL for Python 1.2.3b1 release.

http://sourceforge.net/project/showfiles.php?group_id=22307&package_id=34790&release_id=658932


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:解决 MySQL

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址