2017-11-04 11 views
1

私は以前の開発者ですが、これまでにPythonをあまり使っていません。私はテキストファイルがうまくいく前にMySQLサーバに完全なIMDBデータベースを取得しようとしています。IMDBPyインストールのmysqlclientが失敗する - Python 2.7 Windows

IMDBPyにはPython 2.7が必要です(Davidに感謝!)ので、Py 2.7がインストールされたクリーンなマシンを使用しています。私の理解では、imdbpy2sqlスクリプトを正常に実行するには、いくつかのパッケージがインストールされている必要があります。

これらは次のとおりです。

  • のPython 2.7
  • (コミュニティサーバ5.7.2の最新バージョンを使用して)MySQLの
  • SQLオブジェクト
  • はmysqlclientは(Pythonの 2.7のためのVC++ complilerが必要です)

私はすべてmysqlclientにインストールされています。インストールしようとすると、MySQLの\ includeフォルダが見つからないことを示すメッセージが表示されて失敗します。私には、フォルダを確認している

C:\Windows\system32>pip install -U SQLObject 
Collecting SQLObject 
    Downloading SQLObject-3.4.0-py2.py3-none-any.whl (1.7MB) 
    100% |################################| 1.8MB 652kB/s 
Collecting PyDispatcher>=2.0.4 (from SQLObject) 
    Downloading PyDispatcher-2.0.5.tar.gz 
Collecting FormEncode!=1.3.0,>=1.1.1 (from SQLObject) 
    Downloading FormEncode-1.3.1.tar.gz (197kB) 
    100% |################################| 204kB 3.3MB/s 
Installing collected packages: PyDispatcher, FormEncode, SQLObject 
    Running setup.py install for PyDispatcher ... done 
    Running setup.py install for FormEncode ... done 
Successfully installed FormEncode-1.3.1 PyDispatcher-2.0.5 SQLObject-3.4.0 

C:\Windows\system32>pip install mysqlclient 
Collecting mysqlclient 
    Downloading mysqlclient-1.3.12.tar.gz (89kB) 
    100% |################################| 92kB 837kB/s 
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\\michael\\appdata\\local\\temp\\pip-build-jgsnac\\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\michael\appdata\local\temp\pip-uwgilx-record\install-record.txt --single-version-externally-managed --compile: 
    running install 
    running build 
    running build_py 
    creating build 
    creating build\lib.win-amd64-2.7 
    copying _mysql_exceptions.py -> build\lib.win-amd64-2.7 
    creating build\lib.win-amd64-2.7\MySQLdb 
    copying MySQLdb\__init__.py -> build\lib.win-amd64-2.7\MySQLdb 
    copying MySQLdb\compat.py -> build\lib.win-amd64-2.7\MySQLdb 
    copying MySQLdb\connections.py -> build\lib.win-amd64-2.7\MySQLdb 
    copying MySQLdb\converters.py -> build\lib.win-amd64-2.7\MySQLdb 
    copying MySQLdb\cursors.py -> build\lib.win-amd64-2.7\MySQLdb 
    copying MySQLdb\release.py -> build\lib.win-amd64-2.7\MySQLdb 
    copying MySQLdb\times.py -> build\lib.win-amd64-2.7\MySQLdb 
    creating build\lib.win-amd64-2.7\MySQLdb\constants 
    copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-2.7\MySQLdb\constants 
    copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-2.7\MySQLdb\constants 
    copying MySQLdb\constants\CR.py -> build\lib.win-amd64-2.7\MySQLdb\constants 
    copying MySQLdb\constants\ER.py -> build\lib.win-amd64-2.7\MySQLdb\constants 
    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-2.7\MySQLdb\constants 
    copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-2.7\MySQLdb\constants 
    copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-2.7\MySQLdb\constants 
    running build_ext 
    building '_mysql' extension 
    creating build\temp.win-amd64-2.7 
    creating build\temp.win-amd64-2.7\Release 
    C:\Users\Michael\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_info=(1,3,12,'final',0) -D__version__=1.3.12 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" -Ic:\python27\include -Ic:\python27\PC /Tc_mysql.c /Fobuild\temp.win-amd64-2.7\Release\_mysql.obj /Zl 
    _mysql.c 
    _mysql.c(29) : fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory 
    error: command 'C:\\Users\\Michael\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2 

    ---------------------------------------- 
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\michael\\appdata\\local\\temp\\pip-build-jgsnac\\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\michael\appdata\local\temp\pip-uwgilx-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\michael\appdata\local\temp\pip-build-jgsnac\mysqlclient\ 

があるだけでなく、mysql.hをファイルには、探している(デフォルトのインストール場所でした「C:\プログラムファイル\のMySQL \ MySQLサーバ5.7 \含めます」)。私はPython(3)の新しいバージョンを使用していたときにmysqlclientをインストールするのに問題はありませんでした。だから私は2.7バージョンと新しいバージョンのMySQLの間にいくつかの接続が切断されていると仮定しています。おそらく、設定ファイルを更新する必要がありますか?どんな助けもありがとう。

+0

あなたは管理者のプロンプト 'mysqlclient'をインストールPIPとして実行して同じコマンドを再試行することができますか? –

+0

表示される出力は、管理者として実行されたコマンドプロンプトからのものです。コマンドプロンプトウィンドウのテキストタイトルに「Administrator:コマンドプロンプト」と表示されます。 – DocMagro

答えて

1

ドライバを最初にインストールしてから動作してください。

  1. ダウンロード&次のリンクからPython MySQL Connectorドライバをインストールしてください。 https://dev.mysql.com/downloads/connector/c/6.0.html#downloads

  2. ピップは、MySQL-Pythonのインストール

参照してください:https://github.com/PyMySQL/mysqlclient-python/issues/142

+0

提案をいただきありがとうございます。コネクタが正常にインストールされました。あなたが示唆したgithubスレッドを見た後、私はProgram Files(parent + subs)からProgram Files(x86)(parent + subs)にコネクター・フォルダーをコピーし、推奨どおりに名前を変更しました。 "pip-MySQLをインストールしてPythonをインストールすると、" _mysql.c(42)というエラーが表示されました。致命的なエラーC1083:インクルードファイルを開くことができません: 'config-win.h':そのようなファイルやディレクトリはありません " 。管理者のコマンドプロンプトから実行します。 – DocMagro

+0

@DocMagroようこそ! –

+0

@DocMagroは、Windows環境でMySQL-Pythonをインストールするのが面倒なことがあります。この回答は役に立ちます:https://stackoverflow.com/a/5685209/253358 –

関連する問題