Building MySQLdb for Python on Windows
2011-07-08 23:13
417 查看
Building MySQLdb for Python on Windows
MySQLdb is perhaps the most widely used interface between python and MySQL. Sadly for the python developers on Windows, there are no official pre-built binaries for MySQLdb for window. You are expected to build for your own system using the scripts provided.As almost always is the case, this path is fraught with problems. I have documented below the problems I ran into while building MySQLdb myself.System:
Win32 (XP)
Microsoft Visual C++ compiler
MySQL developer build: to install this make sure that you select the “C headers\libs” option on the installation configuration page (this usually is the first page of the wizard). If you do not have these components installed you will see errors like this: _mysql.c(34) : fatal error C1083: Cannot open include file: ‘config-win.h’: No such file or directory
error: command ‘”C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe”‘ failed with exit
status 2
setuptools.py: get the installer from http://pypi.python.org/pypi/setuptools
Steps to install:
open site.cfg and look for the line: registry_key = SOFTWARE\MySQL AB\MySQL Server 5.0, update it for your version of MySQL, I changed it to registry_key = SOFTWARE\MySQL AB\MySQL Server 5.1
run pythonsetup.py build
if you get error like this: build\temp.win32-2.6\Release\_mysql.pyd.manifest : general error c1010070: Faile
d to load and parse the manifest. The system cannot find the file specified.
error: command ‘mt.exe’ failed with exit status 31
As suggested here do the following:
go to C:\Program Files\Python26\Lib\distutils or a similar path depending on where your target python version is installed
open the file msvc9compiler.py and look for MANIFESTFILE, you should see the following line
ld_args.append(’/MANIFESTFILE:’ + temp_manifest)
Add another line just after this one
ld_args.append(’/MANIFEST’)
run python setup.py bdist_wininst . Thus will give you an executable in the \dist directory, run this .exe file and get going!
相关文章推荐
- MySQLdb For Python On Windows
- Building GTK apps for MS Windows on Linux
- windows下用Python连接mysql报错问题“MySQLdb in Python: “Can't connect to MySQL server on 'localhost'””
- Installing OpenCV on Windows 7 for Python 2.7
- Python Client For Redis On Windows
- Install MySQL 5 for Python 2.6 (and django) on Windows
- Building Apps for Windows 10 on LattePanda–Jump Start
- Python_Building Twisted on Windows
- Generated AOT code is wrong when building for iOS on Windows
- Windows下python安装MySQLdb
- Forms and Reports Developer 10g Certified on Windows 10 for EBS 12.x
- python MySQLdb Windows下安装教程及问题解决方法
- execute python as string on terminal for proprtype
- 【神经网络与深度学习】【Python开发】Caffe配置 windows下怎么安装protobuf for python
- [zz]Common loading points for viruses, worms, and Trojan horse programs on Windows 2000/XP/2003
- Lua for windows中SciTe开启支持python的方法
- How to install Windows on your Mac for free
- Java™ Development on PDAs: Building Applications for PocketPC and Palm Devices
- Windows下Python添加MySQLdb扩展模块
- windows平台使用Microsoft Visual C++ Compiler for Python 2.7编译python扩展