python-mysql

Python 安装mysql出问题

  1. 使用的是mamp 用的里面的mysql 当我使用pip install mysql-python安装的时候出现 mysql_config没有找到的错误.
    解决办法:环境变量添加 export PATH=”/Application/MAMP/Library/bin:$PATH”
  2. 通过 brew install mysql-connector-c pip install mysql-python 安装出现IndexError:string index out of range 解决办法:By finding out the information that mysql-connector-cmight come to the conclusion that the configuration by brew installation may be incorrect , open the /usr/local/bin/mysql_config script to modify some of the contents of it:
    1
    2
    3
    #Create options
    Libs = "-L $ pkglibdir "
    Libs = " $ libs -l"

change into:

1
2
3
#Create options
Libs = "- L $ pkglibdir"
Libs = "$ libs -lmysqlclient -lssl -lcrypto"

感谢土豪
0%