“my_config.h” file not found when install mysql-python on osx 10.8

前端 未结 12 2051
礼貌的吻别
礼貌的吻别 2020-12-07 11:06

I face this problem when I want to install mysql-python on osx 10.8, it show error with \'my_config.h\' file not found.

Below is my running code:

sud         


        
12条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-07 12:06

    I checked the include folders for both mysql and mysql-connector-c installed by homebrew and was surprised to see there is NO file named my_config.h. Thus, I think existing high-voted answers can no longer solve the problem.

    Here is my solution for mysql 8.0.19. I copied the mysql.h file under the include/ folder of my installed mysql-connector-c and saved it as my_config.h under the same folder. Then I followed the high-voted solution as below and successfully installed mysql-python 1.2.5.

    brew install mysql
    brew unlink mysql
    brew install mysql-connector-c   # modify the include/ folder after installing the package
    sed -i -e 's/libs="$libs -l "/libs="$libs -lmysqlclient -lssl -lcrypto"/g' /usr/local/Cellar/mysql/8.0.19/bin/mysql_config
    pip install MySQL-python
    brew unlink mysql-connector-c
    brew link --overwrite mysql
    

    At present, I only know it can successfully install the package, but I am not sure whether it is a safe solution.

    Actually, mysql-python is a quite old package (the latest release is 6 years ago), I recommend other packages for interacting with mysql in python (e.g. mysql-connector-python).

提交回复
热议问题