mac下 python3.5安装mysqlclient

由于本人使用的mac+python3.5安装MySQLdb报错

网上搜索后发现mac版本python3以上安装 brew install mysqlclient

mysqlclient(https://github.com/PyMySQL/mysqlclient-python)github地址

Prerequisites

You may need to install the Python and MySQL development headers and libraries like so:

sudo apt-get install python-dev libmysqlclient-dev # Debian / Ubuntu

sudo yum install python-devel mysql-devel # Red Hat / CentOS

On Windows, there are binary wheel you can install without MySQLConnector/C or MSVC.

Note on Python 3 : if you are using python3 then you need to install python3-dev using the following command :

sudo apt-get install python3-dev # debian / Ubuntu

sudo yum install python3-devel # Red Hat / CentOS

brew install mysql-connector-c # macOS (Homebrew)


安装  brew install mysql-connector-c # macOS (Homebrew)

继续报错:

brew install mysql-connector-c produces an error on macOS Sierra: Error: Cannot install mysql-connector-c because conflicting formulae are installed. mysql: because both install MySQL client libraries Please brew unlink mysql before continuing. Unlinking removes a formula's symlinks from /usr/local. You can link the formula again after the install finishes. You can --force this install, but the build may fail or cause obscure side-effects in the resulting software.

brew unlink mysql

继续填坑

nstall mysql connector using homebrewbrew install mysql-connector-c then install mysql-python using pippip install mysql-python or try PyMySQL its a pure python client library, you can install usingpip install PyMySQL and upgrade setuptools.

pip install --upgrade setuptools.


继续走:

Install from source

  1. Download source by git clone git@github.com:PyMySQL/mysqlclient-python.git
  2. Customize site.cfg
  3. python setup.py install

ok 






评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值