Installing MySQL Python on Mac OS X

后端 未结 15 2105
隐瞒了意图╮
隐瞒了意图╮ 2020-11-27 03:02

Long story short, when I write the following:

sudo easy_install MySQL-python

I get the error

EnvironmentError: mysql

15条回答
  •  遥遥无期
    2020-11-27 03:48

    For Python 3+ the mysql-python library is broken. Instead, use the mysqlclient library. Install with: pip install mysqlclient

    It is a fork of mysql-python (also known as MySQLdb) that supports Python 3+

    This library talks to the MySQL client's C-interface, and is faster than the pure-python pymysql libray.

    Note: you will need the mysql-developer tools installed. An easy way to do this on a Mac is to run

    brew install mysql-connector-c
    

    to delegate this task to homebrew. If you are on linux, you can install these via the instructions at the mysqlclient github page.

提交回复
热议问题