2011-03-12 27 views
18

Im tratando de instalar Mysql-python en windows x64.Python: ¿Cómo instalar mysqldb en Windows 7 x64?

He instalado pitón 64, setuptools (marcados en la hoja lib, instalado con éxito), pero no puedo instalar MySQLdb. que intentar ejecutar

C: \ Users \ Fedcomp \ Desktop \ hojas 0,4 \ MySQL-python-1.2.3> python setup.py install

pero atrapar a este

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 

también tratando con msvc pero atrapar a este (MS Visual instalado expreso)

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 

¿Cómo instalar mysqldb correctamente en Windows x64? (cabeceras de instalación de MySQL original porque, en el servidor XAMPP que no existe)

O puede alguien compilar MySQLdb para las ventanas pitón x64 o pitón x 86?

Respuesta

35

EDITAR: mysqlclient tiene paquetes binarios, tanto para 32 bits y 64 bits en PyPI. Es un tenedor de MySQL-python, que no ha visto un lanzamiento desde 2014.

Respuesta original dejó para la posteridad:

puede encontrar instaladores binarios here (Python 2.6 a 3.2), here (2.7) o here (2.6). Tenga en cuenta que no tiene que usar 64 bits de Python en Windows x64. También puede usar una versión de 32 bits de Python, para la cual hay más paquetes de terceros preconstruidos.

+0

+1 Bien encontrado. Respaldaría la sugerencia de usar 32 bits. Hace la vida más fácil. –

+0

Si ya ha instalado otra versión, le sugiero que elimine primero e instale la correcta. –

+0

Solo un pequeño comentario: intenté el primer enlace, y no se puede conectar a mi base de datos (versión para Python 2.7). Pero el controlador del segundo enlace funciona bien. – dbf

1

"No se puede encontrar vcvarsall.bat" significa que no tiene los directorios necesarios de Visual Studio en su ruta.

Sin embargo, si está utilizando Python de 64 bits, entonces necesitará un compilador de 64 bits y Express no viene en sabores de 64 bits. Puede descargar el compilador SDK MSVC y configurarlo, pero es muy difícil.

Si yo fuera tú cambiaría a Python de 32 bits y seguramente obtendrás binarios preconstruidos.

EDITAR

-Pre construida 64 bits binarios que se le han piquadrat sería aún más simple!

1

No estoy 100% seguro, pero creo que las variables de ruta son las culpables. Parece que el compilador no se encuentra, ejecutar una búsqueda de vcvarsall.bat y hacer doble clic en él, debe establecer correctamente las variables de ruta. Y luego intenta instalar nuevamente tu paquete. Si no puede encontrar vcvarsall.bat, vuelva a instalar MS Visual Express.

+4

Pruebe la versión x64 precompilada de MySQL-python desde aquí: [Binarios de Windows no oficiales para paquetes de extensión de Python] (http://www.lfd.uci.edu/~gohlke/pythonlibs/) –

Cuestiones relacionadas