Python:如何在 Windows 7 x64 上安装 mysqldb?

Python: How to install mysqldb on windows 7 x64?(Python:如何在 Windows 7 x64 上安装 mysqldb?)

本文介绍了Python:如何在 Windows 7 x64 上安装 mysqldb?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Im trying install Mysql-python on windows x64.

我安装了 python x64setuptools(检查了 leaf 库,成功安装)但我无法安装 mysqldb.我试图执行

I installed python x64, setuptools (checked on the leaf lib, successfully installed) but i can't install mysqldb. I trying to execute

C:UsersFedcompDesktopleaf-0.4MySQL-python-1.2.3>pythonsetup.py 安装

C:UsersFedcompDesktopleaf-0.4MySQL-python-1.2.3>python setup.py install

但是抓住这个

In file included from _mysql.c:34:
D:serversxampp_serverxamppmysqlinclude/config-win.h:211:1: warning: "finite
" redefined
D:serversxampp_serverxamppmysqlinclude/config-win.h:164:1: warning: this is
 the location of the previous definition
D:serversxampp_serverxamppmysqlinclude/config-win.h:277:1: warning: "HAVE_S
TDDEF_H" redefined
In file included from D:Python27include/Python.h:8,
                 from pymemcompat.h:10,
                 from _mysql.c:29:
D:Python27include/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)

also trying with msvc but catch this (MS Visual express installed)

C:UsersFedcompDesktopleaf-0.4MySQL-python-1.2.3>python setup.py install bui
ld --compiler=msvc
running install
running bdist_egg
running egg_info
writing MySQL_python.egg-infoPKG-INFO
writing top-level names to MySQL_python.egg-info	op_level.txt
writing dependency_links to MySQL_python.egg-infodependency_links.txt
reading manifest file 'MySQL_python.egg-infoSOURCES.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-infoSOURCES.txt'
installing library code to builddist.win-amd64egg
running install_lib
running build_py
copying MySQLdb
elease.py -> buildlib.win-amd64-2.7MySQLdb
running build_ext
building '_mysql' extension
error: Unable to find vcvarsall.bat

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

或者有人可以为 windows python x64python x86 编译 mysqldb 吗?

Or may someone compile mysqldb for windows python x64 or python x86?

推荐答案

EDIT:mysqlclient 在 PyPI.它是 MySQL-python 的一个分支,自 2014 年以来就没有发布过.

EDIT: mysqlclient has binary packages for both 32bit and 64bit on PyPI. It's a fork of MySQL-python, which hasn't seen a release since 2014.

留给后人的原始答案:

您可以在此处找到二进制安装程序(Python 2.6-3.2)、此处 (2.7) 或 此处 (2.6).请注意,您不必在 Windows x64 上使用 64 位 Python.您也可以使用 Python 的 32 位版本,其中有更多预构建的第 3 方包.

You can find binary installers here (Python 2.6-3.2), here (2.7) or here (2.6). Note that you don't have to use 64bit Python on Windows x64. You can just as well use a 32bit build of Python, for which there are more pre-built 3rd party packages around.

这篇关于Python:如何在 Windows 7 x64 上安装 mysqldb?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Python:如何在 Windows 7 x64 上安装 mysqldb?

基础教程推荐