解决 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-
在 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
很明显,是要找到下面注册表项
HKEY_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
推荐阅读
-
mysql load data infile 命令的数据导入
-
New Release Webinar on May 13th: Introducing ClusterControl_MySQL
-
php+mysql第一条数据无法显示的原因和解决方法
-
Ubuntu 下 nginx , php , mysql 和 golang 的简单安装
-
编译安装PHP出现configure: error: mysql configure failed. Plea_PHP教程
-
devstack安装使用openstack常见问题与解决办法_MySQL
-
WordPress迁移时一些常见问题的解决方法整理_PHP
-
新人提问:究竟什么是“第一段子串”(关于strspn()),该怎么解决
-
PHP 生成XML解决方法
-
MySQL更新数据之前是否判断数据有没有被修改