碰到的问题
1、ImportError
原因是我的环境变量PYTHONHOME指定的路径不正确,导致无法导入相应模块
2、python setup.py install
line 7, in get_config serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_key']) WindowsError: [Error 2]
这个原因是因为我是解压包安装的mysql,在注册表中没有对一个的项。
具体可以查看site.cfg文件中registry_key对应的值
解决办法:
在注册表中添加对应的项
HKEY_LOCAL_MACHINE/SOFTWARE/MySQL AB/MySQL Server 5.0
版本不是5.0的修改为对应的版本值。
并新建Location和Version项,Location指定值为mysql的安装路径。
或者
注释掉行mysql_root, dummy = _winreg.QueryValueEx(serverKey,'Location')
修改为:mysql_root=r"mysql的安装路径"
3、安装c/c++ 编译器
MySQL-python-1.2.3c1>setup.py install
running install
running bdist_egg
running egg_info
writing MySQL_python.egg-info\PKG-INFO
writing top-level names to MySQL_python.egg-info\top_level.txt
writing dependency_links to MySQL_python.egg-info\dependency_links.txt
reading manifest file 'MySQL_python.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'MySQL_python.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
copying MySQLdb\release.py -> build\lib.win32-2.6\MySQLdb
running build_ext
building '_mysql' extension
error: Unable to find vcvarsall.bat
安装mingw32,可以参考另一篇文章
4、找不到相应的头文件
>python setup.py build --compiler=mingw32
running build
running build_py
copying MySQLdb\release.py -> build\lib.win-amd64-2.7\MySQLdb
running build_ext
building '_mysql' extension
D:\dev\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -ID:\mysql\incl
ude -ID:\dev\Python27\include -ID:\dev\Python27\PC -c _mysql.c -o build\temp.win-amd64-2.7\Release\_mysql.o /Zl
gcc: /Zl: No such file or directory
_mysql.c:34:24: fatal error: config-win.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
安装mysql-connector-c
分享到:
相关推荐
非MySQL安装MySQL-python,有时不是数据库为封装的MySQL时,可以通过yum -y install mysql-devel 但有时不行,这是可按文档去更改MySQL-python
将下载的MySQL-python-1.2.5的文件解压,然后打开编辑器编辑setup_posix,其中有一行mysql_config.path = "mysql_config",改为mysql_config.path = "/usr/local/Cellar/mysql-connector-c/6.1.11/bin/mysql_config...
1.安装python和mysql 这里就不多介绍了,很简单 2.安装setuptools ...3.下载编译版本 MySQL-python-1.2.3.win-amd64-py2.7.exe 双击安装 4.可以测试了 5.如果出错了,注意看下提示什么错误 直接解压就可以了~
MySQL-python-1.2.5.win-amd64-py2.7 亲测可用版 有效解决安装mysql-python时遇到的error: Unable to find vcvarsall.bat问题,哎,安装mingw什么的,都是浮云啊(搞了一个星期都没有成功啊)!还是这个有用!
MySQL-python-1.2.3
python MySQL-python模块 django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb. Did you install mysqlclient or MySQL-python?
Python2.7 MySQL安装MySQL-python-1.2.3.win-amd64-py2.7
python连接MySQL驱动,windows64位系统上安装mysql-python
MySQL-python-1.2.3-0.3.c1.1.el6.x86_64的rpm包,供下载
python连接mysql模块mysql-connector-python-2.1.1.tar.gz
MySQL-python-1.2.3.win32-py2.7.exe MySQL-python-1.2.3.win-amd64-py2.7.exe
django,liunx下mysql数据库接口MySQL-python-1.2.3.tar.gz
centos6 下安装MySQL-python.docx
安装Mysql-python时报错Adding Python Information to the Windows Registry 需要使用register.py cmd python register.py
python在windows中连接mysql的驱动MySQL-python-1.2.2.win32-py2.6 快速,安全,稳定
mysql-connector-python-2.1.7.tar.gz
自己用VC++6.0编译的 MySQL-python,需要 MySQL-5.1.34 的 libMySQL.dll 和Python2.6的“Set”有点兼容性问题,自己照着改一下: http://sourceforge.net/forum/message.php?msg_id=5808948 1)__init__.py 删除 ...
下载编译安装MySQL-python-1.2.5.zip需要各种依赖,安装完成后,取出egg文件可离线安装,已编译MySQL-python模块,可离线配置
今天小编就为大家分享一篇Anaconda下安装mysql-python的包实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
MySQL-python-1.2.3.win32-py2.7.msi