MAC OS X下安装MySQL-python

首次在mac os 下,用pip install MySQLPython时经常出现如下错误:

“`

sh: mysql_config: command not found

Traceback (most recent call last):

File “setup.py”, line 15, in

metadata, options = get_config()

File “/Users/***/Downloads/MySQL-python-1.2.3/setup_posix.py”,

line 43, in get_config

libs = mysql_config(“libs_r”)

File “/Users/***/Downloads/MySQL-python-1.2.3/setup_posix.py”,

line 24, in mysql_config

raise EnvironmentError(“%s not found” % (mysql_config.path,))

EnvironmentError: mysql_config not found

“`

解决办法:

1.从MySQL官网下载并安装MySQL  https://dev.mysql.com/downloads/mysql/

2.在终端terminal中cd 到虚拟环境并启动虚拟环境

在虚拟环境中修改环境变量

(venv)$PATH=”$PATH”:/usr/local/mysql/bin

3.重启终端,进去虚拟环境并输入

pip install mysql-python

安装完成

    原文作者:raphah
    原文地址: https://www.jianshu.com/p/5f4537d2c10f
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞