22
21

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

macでのmysql-connector-pythonインストール方法

Posted at

Macでpipからmysql-connector-pythonのインストールに失敗したのでメモ

$ pip search mysql
mysql-connector-python (2.0.4)         - MySQL driver written in Python
  # 検索して出てくるからインストールできると思った

$ pip install mysql-connector-python==2.0.4
Collecting mysql-connector-python==2.0.4
  Could not find a version that satisfies the requirement mysql-connector-python==2.0.4 (from versions: )
No matching distribution found for mysql-connector-python==2.0.4
  # 検索結果にいたのにMac用に用意されていなかったためかエラーに。
  # バージョン未指定でも同様
  # 導入中のPythonのバージョンに依存したものかもしれない。(自分はpython2.7.10で確認)

似たような詰まり方をされている方がいたので、真似っこしたらすんなり解消
(参考:StackOverFlow - How do you install mysql-connector-python

$  git clone https://github.com/mysql/mysql-connector-python.git
$  cd mysql-connector-python
$  python ./setup.py build
$  sudo python ./setup.py install

$ python
>>> import mysql.connector as msc
>>> msc.__version__
'2.1.3'
22
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
22
21

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?