首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Python:如何在windows7 x64上安装mysqldb?

Python:如何在windows7 x64上安装mysqldb?
EN

Stack Overflow用户
提问于 2011-03-13 01:34:23
回答 3查看 48.1K关注 0票数 18

我正在尝试在windows x64上安装Mysql-python

我安装了python x64setuptools (在库上检查,安装成功),但是我不能安装mysqldb。我试着执行

C:\Users\Fedcomp\Desktop\leaf-0.4\MySQL-python-1.2.3>python setup.py安装

但是请注意这个

代码语言:javascript
复制
In file included from _mysql.c:34:
D:\servers\xampp_server\xampp\mysql\include/config-win.h:211:1: warning: "finite
" redefined
D:\servers\xampp_server\xampp\mysql\include/config-win.h:164:1: warning: this is
 the location of the previous definition
D:\servers\xampp_server\xampp\mysql\include/config-win.h:277:1: warning: "HAVE_S
TDDEF_H" redefined
In file included from D:\Python27\include/Python.h:8,
                 from pymemcompat.h:10,
                 from _mysql.c:29:
D:\Python27\include/pyconfig.h:673:1: warning: this is the location of the previ
ous definition
error: command 'gcc' failed with exit status 1

也尝试使用msvc,但遇到此问题(已安装MS Visual express )

代码语言:javascript
复制
C:\Users\Fedcomp\Desktop\leaf-0.4\MySQL-python-1.2.3>python setup.py install bui
ld --compiler=msvc
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'
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
writing manifest file 'MySQL_python.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
copying MySQLdb\release.py -> build\lib.win-amd64-2.7\MySQLdb
running build_ext
building '_mysql' extension
error: Unable to find vcvarsall.bat

如何在windows x64上正确安装mysqldb?(来自原始mysql安装的头文件,因为在xampp服务器中它们不存在)

或者有人为windows python x64python x86编译mysqldb。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2011-03-13 01:43:39

编辑mysqlclientPyPI上有32位和64位的二进制软件包。它是MySQL-python的一个分支,自2014年以来就没有发布过。

最初的答案留给子孙后代:

您可以找到二进制安装程序here (Python2.6-3.2)、here (2.7)或here (2.6)。请注意,您不必在Windows x64上使用64位Python。你也可以使用32位版本的Python,对于它,有更多的预先构建的第三方包。

票数 35
EN

Stack Overflow用户

发布于 2011-03-13 02:02:31

我不能百分之百确定,但我认为path变量是罪魁祸首。似乎没有找到编译器,运行搜索vcvarsall.bat并双击它,它应该正确地设置您的path变量。然后尝试再次安装您的软件包。如果找不到vcvarsall.bat,请重新安装MS Visual Express。

票数 2
EN

Stack Overflow用户

发布于 2011-03-13 01:45:14

"Unable to find vcvarsall.bat“意味着你的path中没有必要的Visual Studio目录。

但是,如果您使用的是64位Python,那么您将需要一个64位编译器,而Express没有64位版本。您可以下载SDK MSVC编译器并对其进行配置,但这是非常困难的工作。

如果我是你,我会切换到32位Python,你几乎肯定可以得到预先构建的二进制文件。

编辑

piquadrat发现的预先构建的64位二进制文件会更简单!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5284186

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档