2017-05-26 34 views
0

我試圖安裝mysql-蟒蛇,我已經試過在PIP兩種方法不能安裝MySQL的Python不能建立或使用滾輪

  1. python -m pip install mysql-python

    • 這不起作用說「失敗建築控制盤爲MySQL的Python」
  2. 下載車輪MySQL_python-1.2.5-cp27-NONE-win_amd64和MySQL_python-1.2.5-cp27-NONE-Win32中的d試圖用命令分別安裝它們 python -m pip install filename

    • 這並不是在所有情況下工作,說這是「此平臺不支持」

是否有任何人知道什麼是對是錯的,我如何安裝mysql-python?

更新

因爲寫這個我仍然有麻煩MySQLdb的工作,但已經嘗試了一些事情。

1)我使用Python 3.5 mysql-python是爲Python 2.x,我應該一直試圖安裝mysqlclient。不過,我現在有類似的問題,如上安裝mysqlclient與輪子和只是點。

> pip install mysqlclient 




Collecting mysqlclient 
    Using cached mysqlclient-1.3.10.tar.gz 
Installing collected packages: mysqlclient 
    Running setup.py install for mysqlclient ... error 
    Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\teddy\\appdata\\local\\temp\\pip-build-lhtha0\\mysqlclient\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\teddy\appdata\local\temp\pip-stnbio-record\install-record.txt --single-version-externally-managed --compile: 
    running install 
    running build 
    running build_py 
    creating build 
    creating build\lib.win32-2.7 
    copying _mysql_exceptions.py -> build\lib.win32-2.7 
    creating build\lib.win32-2.7\MySQLdb 
    copying MySQLdb\__init__.py -> build\lib.win32-2.7\MySQLdb 
    copying MySQLdb\compat.py -> build\lib.win32-2.7\MySQLdb 
    copying MySQLdb\connections.py -> build\lib.win32-2.7\MySQLdb 
    copying MySQLdb\converters.py -> build\lib.win32-2.7\MySQLdb 
    copying MySQLdb\cursors.py -> build\lib.win32-2.7\MySQLdb 
    copying MySQLdb\release.py -> build\lib.win32-2.7\MySQLdb 
    copying MySQLdb\times.py -> build\lib.win32-2.7\MySQLdb 
    creating build\lib.win32-2.7\MySQLdb\constants 
    copying MySQLdb\constants\__init__.py -> build\lib.win32-2.7\MySQLdb\constants 
    copying MySQLdb\constants\CLIENT.py -> build\lib.win32-2.7\MySQLdb\constants 
    copying MySQLdb\constants\CR.py -> build\lib.win32-2.7\MySQLdb\constants 
    copying MySQLdb\constants\ER.py -> build\lib.win32-2.7\MySQLdb\constants 
    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-2.7\MySQLdb\constants 
    copying MySQLdb\constants\FLAG.py -> build\lib.win32-2.7\MySQLdb\constants 
    copying MySQLdb\constants\REFRESH.py -> build\lib.win32-2.7\MySQLdb\constants 
    running build_ext 
    building '_mysql' extension 
    creating build\temp.win32-2.7 
    creating build\temp.win32-2.7\Release 
    C:\Users\teddy\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_info=(1,3,10,'final',0) -D__version__=1.3.10 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" -Ic:\python27\include -Ic:\python27\PC /Tc_mysql.c /Fobuild\temp.win32-2.7\Release\_mysql.obj /Zl 
    _mysql.c 
    _mysql.c(29) : fatal error C1083: Cannot open include file: 'my_config.h': No such file or directory 
    error: command 'C:\\Users\\teddy\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2 

    ---------------------------------------- 
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\teddy\\appdata\\local\\temp\\pip-build-lhtha0\\mysqlclient\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\teddy\appdata\local\temp\pip-stnbio-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\teddy\appdata\local\temp\pip-build-lhtha0\mysqlclient\ 

2)我已經嘗試安裝MySQL連接器C.這並沒有改變任何東西。

3)我試圖得到它的Spyder工作附帶蟒蛇

的IDE

因此,誰能提出任何其他

+1

什麼平臺是你嗎? –

+0

這可能有所幫助:https://stackoverflow.com/a/25865271/2148023 –

+0

感謝Carles,我在windows上,主要使用Python 3.5,但我也安裝了2.7。我也開始在Annaconda軟件包中使用Spyder。 我試圖複製並粘貼命令從您的鏈接,以確保其權利,並得到了相同的結果。我已閱讀鏈接,並嘗試下載車輪文件並安裝它們。 –

回答

1

我終於做到了。有兩件事情改變了我得到它的工作:

  1. 我皮普指着Python中的舊版本,我有我 計算機上,由於某種原因被閒置採摘它而不是Spyder的。
  2. 我不得不搬到從MySQL連接器文件中的一個:

C:\Program Files\MySQL to C:\Program Files (x86)\MySQL

+0

請看看[我可以回答我自己的問題嗎?](http://stackoverflow.com/help/self-answer),並在兩天後回來查看回答。 –