简体   繁体   English

使用pip安装MySQL在Windows上安装MySQL-python无法正常工作?

[英]Install MySQL using pip install MySQL-python on Windows not working?

I couldn't install the mysql package and have looked at many solutions but nothing solved the issue. 我无法安装mysql软件包,并且查看了许多解决方案,但没有任何解决方案。 Please help, and tell what I need to do to make this work. 请帮忙,并告诉我需要做些什么才能完成这项工作。

After running the command, this was displayed: 运行命令后,将显示以下内容:

Collecting mysql-python
Using cached MySQL-python-1.2.5.zip
Installing collected packages: mysql-python
Running setup.py install for mysql-python
Complete output from command "C:\Program Files (x86)\Python_3.4.3\python.exe
" -c "import setuptools, tokenize;__file__='C:\\Users\\RNN\\AppData\\Local\\Temp
\\pip-build-rauxmcb1\\mysql-python\\setup.py';exec(compile(getattr(tokenize, 'op
en', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install -
-record C:\Users\RNN\AppData\Local\Temp\pip-0cir5bet-record\install-record.txt -
-single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-3.4
copying _mysql_exceptions.py -> build\lib.win32-3.4
creating build\lib.win32-3.4\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.4\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.4\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.4\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.4\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.4\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.4\MySQLdb
creating build\lib.win32-3.4\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.4\MySQLdb\constan
ts
copying MySQLdb\constants\CR.py -> build\lib.win32-3.4\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.4\MySQLdb\const
ants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.4\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.4\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.4\MySQLdb\constant
s
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.4\MySQLdb\constants

running build_ext
building '_mysql' extension
creating build\temp.win32-3.4
creating build\temp.win32-3.4\Release
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo
/Ox /MD /W3 /GS- /DNDEBUG -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5
"-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" "-IC:\Program F
iles (x86)\Python_3.4.3\include" "-IC:\Program Files (x86)\Python_3.4.3\include"
/Tc_mysql.c /Fobuild\temp.win32-3.4\Release\_mysql.obj /Zl
_mysql.c
_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h':
No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\B
IN\\cl.exe' failed with exit status 2

Then this was in red: 然后这是红色的:

Command ""C:\Program Files (x86)\Python_3.4.3\python.exe" -c "import setuptools,
 tokenize;__file__='C:\\Users\\RNN\\AppData\\Local\\Temp\\pip-build-rauxmcb1\\my
sql-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).rea
d().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\RNN\App
Data\Local\Temp\pip-0cir5bet-record\install-record.txt --single-version-external
ly-managed --compile" failed with error code 1 in C:\Users\RNN\AppData\Local\Tem
p\pip-build-rauxmcb1\mysql-python

All I had to do was go over to oracle, and download the MySQL Connector C 6.0.2 and do the typical install. 我要做的就是转到oracle,然后下载MySQL Connector C 6.0.2并进行典型安装。

http://dev.mysql.com/downloads/connector/c/6.0.html#downloads http://dev.mysql.com/downloads/connector/c/6.0.html#downloads

Once that was done, I went into pycharms, and selected the MySQL-python==1.2.4 package to install, and it worked great. 完成此操作后,我进入pycharms,并选择要安装的MySQL-python == 1.2.4软件包,它运行良好。 No need to update any configuration or anything like that. 无需更新任何配置或类似内容。 This was the simplest version for me to work through. 对于我来说,这是最简单的版本。

Hope it helps. 希望能帮助到你。

On its pypi listing here , mysql db currently has support for python up to 2.7. 此处的 pypi列表中,mysql db当前支持python 2.7以上的版本。 There are other mysql packages though, see mysqlclient . 虽然还有其他mysql软件包,请参见mysqlclient

https://pypi.python.org/pypi/MySQL-python/1.2.5安装.exe安装程序对我来说很有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM