質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

MySQL

MySQL(マイエスキューエル)は、TCX DataKonsultAB社などが開発するRDBMS(リレーショナルデータベースの管理システム)です。世界で最も人気の高いシステムで、オープンソースで開発されています。MySQLデータベースサーバは、高速性と信頼性があり、Linux、UNIX、Windowsなどの複数のプラットフォームで動作することができます。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Q&A

解決済

2回答

8419閲覧

CentOS7でmysqlclientがインストールできない

gyungyun545

総合スコア84

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

MySQL

MySQL(マイエスキューエル)は、TCX DataKonsultAB社などが開発するRDBMS(リレーショナルデータベースの管理システム)です。世界で最も人気の高いシステムで、オープンソースで開発されています。MySQLデータベースサーバは、高速性と信頼性があり、Linux、UNIX、Windowsなどの複数のプラットフォームで動作することができます。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

0グッド

1クリップ

投稿2019/03/31 03:51

CentOS7でmysqlを導入してpythonのpandasからテーブルを作成しようとしてます。
色々試しておりますが、mysqlclientが必要みたいですが、インストールエラーが発生し詰まっております。
なかなか方法がわからずに悩んでおります。
どなたかご教授いただければ幸いです。

<環境>
OS : CentOS Linux release 7.6.1810 (Core)
pip : pip 19.0.3 from /usr/lib/python3.6/site-packages/pip (python 3.6)
gcc : gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)
mysql: mysql Ver 15.1 Distrib 10.3.13-MariaDB, for Linux (x86_64) using readline 5.1
実行シェル:/bin/bash

<エラー内容>
[root@xxxx]# pip install mysqlclient
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command /usr/bin/python3.6 -u -c "import setuptools, tokenize;file='/tmp/pip-install-nbln866v/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 /tmp/pip-record-9xlnjmqh/install-record.txt --single-version-externally-managed --compile:
/usr/lib64/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/init.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/exceptions.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.6/MySQLdb
creating build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/init.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
running build_ext
building 'MySQLdb.mysql' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/MySQLdb
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,4,2,'post',1) -D__version
=1.4.2.post1 -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o
gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o -L/usr/lib64/ -L/usr/lib64 -lmariadb -lz -ldl -lm -lpthread -lssl -lcrypto -lpython3.6m -o build/lib.linux-x86_64-3.6/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so
/usr/bin/ld: -lmariadb が見つかりません
/usr/bin/ld: -lz が見つかりません
collect2: エラー: ld はステータス 1 で終了しました
error: command 'gcc' failed with exit status 1

----------------------------------------

Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;file='/tmp/pip-install-nbln866v/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 /tmp/pip-record-9xlnjmqh/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-nbln866v/mysqlclient/

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

自己解決

解決しました。

>/usr/bin/ld: -lmariadb が見つかりません
>/usr/bin/ld: -lz が見つかりません
このメッセージの通り、いくつかのパッケージが不足していたみたいです。

yum install -y MariaDB-devel MariaDB-shared
yum install openssl-devel zlib-devel

<参考>
https://qiita.com/sabamotto/items/31fd6f4799c9a88ad8e1
https://teratail.com/questions/64431

投稿2019/03/31 07:32

gyungyun545

総合スコア84

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

mysqlclient のインストールにはたしか python-devel と mysql-devel が必要だったはずです。この2つを yum でインストールしてから再度 pip install してみてください。

投稿2019/03/31 06:25

miyahan

総合スコア3095

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

gyungyun545

2019/03/31 07:14 編集

ご教授いただきありがとうございます。 確認しましたが、両方ともインストール済みでした。 やはりこれだけではできないです。 [root@xxxx]# yum install python-devel 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.cat.net * epel: mirrors.aliyun.com * extras: mirrors.cat.net * ius: mirrors.tuna.tsinghua.edu.cn * updates: mirrors.cat.net パッケージ python-devel-2.7.5-76.el7.x86_64 はインストール済みか最新バージョンです 何もしません [root@xxxx]# yum install mysql-devel 読み込んだプラグイン:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.cat.net * epel: mirrors.aliyun.com * extras: mirrors.cat.net * ius: mirrors.tuna.tsinghua.edu.cn * updates: mirrors.cat.net パッケージ MariaDB-devel-10.3.13-1.el7.centos.x86_64 はインストール済みか最新バ ージョンです 何もしません
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問