17

django/pip/mysql を動作させようとしていますが、mysql-python のインストール方法がわかりません。これは、mysql-python をインストールしようとしたときに受け取るエラーです。

pip install mysql-python

mysql-python のダウンロード/解凍
  MySQL-python-1.2.4.zip (113kB) のダウンロード: 113kB ダウンロード
  パッケージ mysql-python の setup.py egg_info の実行
    http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz のダウンロード
    /tmp/tmp5jjdpf に解凍
    /tmp/tmp5jjdpf/distribute-0.6.28 で作業中
    /home/brian/flaskapp/build/mysql-python で配布卵を構築する
    /home/brian/flaskapp/build/mysql-python/distribute-0.6.28-py2.7.egg

収集したパッケージのインストール: mysql-python
  mysql-python の setup.py install の実行
    '_mysql' 拡張機能を構築しています
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,4,'final',1) -D__version__= 1.2.4 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-エイリアシング -g -DNDEBUG
    _mysql.c:29:20: 致命的なエラー: Python.h: そのようなファイルまたはディレクトリはありません
    コンパイルが終了しました。
    エラー: コマンド 'x86_64-linux-gnu-gcc' が終了ステータス 1 で失敗しました
    コマンド /home/brian/flaskapp/bin/python -c "import setuptools;__file__='/home/brian/flaskapp/build/mysql-python/setup.py';exec(compile(open(__file__). read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Ur7r16-record/install-record.txt --single-version -externally-managed --install-headers /home/brian/flaskapp/include/site/python2.7:
    インストールの実行中

実行中のビルド

build_py の実行

ビルドの作成

build/lib.linux-x86_64-2.7 の作成

_mysql_exceptions.py のコピー -> build/lib.linux-x86_64-2.7

build/lib.linux-x86_64-2.7/MySQLdb の作成

MySQLdb/__init__.py のコピー -> build/lib.linux-x86_64-2.7/MySQLdb

MySQLdb/converters.py のコピー -> build/lib.linux-x86_64-2.7/MySQLdb

MySQLdb/connections.py のコピー -> build/lib.linux-x86_64-2.7/MySQLdb

MySQLdb/cursors.py のコピー -> build/lib.linux-x86_64-2.7/MySQLdb

MySQLdb/release.py のコピー -> build/lib.linux-x86_64-2.7/MySQLdb

MySQLdb/times.py のコピー -> build/lib.linux-x86_64-2.7/MySQLdb

build/lib.linux-x86_64-2.7/MySQLdb/constants の作成

MySQLdb/constants/__init__.py のコピー -> build/lib.linux-x86_64-2.7/MySQLdb/constants

MySQLdb/constants/CR.py のコピー -> build/lib.linux-x86_64-2.7/MySQLdb/constants

MySQLdb/constants/FIELD_TYPE.py のコピー -> build/lib.linux-x86_64-2.7/MySQLdb/constants

MySQLdb/constants/ER.py のコピー -> build/lib.linux-x86_64-2.7/MySQLdb/constants

MySQLdb/constants/FLAG.py のコピー -> build/lib.linux-x86_64-2.7/MySQLdb/constants

MySQLdb/constants/REFRESH.py のコピー -> build/lib.linux-x86_64-2.7/MySQLdb/constants

MySQLdb/constants/CLIENT.py のコピー -> build/lib.linux-x86_64-2.7/MySQLdb/constants

build_ext の実行

'_mysql' 拡張機能を構築しています

build/temp.linux-x86_64-2.7 の作成

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,4,'final',1) -D__version__= 1.2.4 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-エイリアシング -g -DNDEBUG

_mysql.c:29:20: 致命的なエラー: Python.h: そのようなファイルまたはディレクトリはありません

コンパイルが終了しました。

エラー: コマンド 'x86_64-linux-gnu-gcc' が終了ステータス 1 で失敗しました

--------------------------------------------
清掃...
コマンド /home/brian/flaskapp/bin/python -c "import setuptools;__file__='/home/brian/flaskapp/build/mysql-python/setup.py';exec(compile(open(__file__).read() .replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Ur7r16-record/install-record.txt --single-version-externally- managed --install-headers /home/brian/flaskapp/include/site/python2.7 は、/home/brian/flaskapp/build/mysql-python でエラー コード 1 で失敗しました
完全なログを /home/brian/.pip/pip.log に保存する

グーグルは、python-devをインストールする必要があることを明らかにしましたが、インストールしようとするたびに

sudo apt-get install python-dev

私はこのエラーが発生します:

E: パッケージ 'python-dev' にはインストール候補がありません

私は現在、Linux Mint 15 RC を使用していますが、それが問題である可能性があると思います...しかし、よくわかりません。私はアイデアがありません:(

4

4 に答える 4

0

試す

apt-get install python-mysqldb

私のために働いた。

于 2014-05-01T05:58:37.273 に答える
0

最初にターミナルに実行して、以下のようにパスを作成します

export PATH=/usr/local/mysql/bin:$PATH

これを実行した後、次のコマンドを端末に実行します

sudo pip3 install flask-mysqldb

于 2020-02-19T05:01:34.267 に答える