最近项目移植, 再进行virtualenv环境安装的时候遇到mysql-python死活安装失败

首先是这个错误:

sh: /usr/local/bin/mysql_config: No such file or directory
Traceback (most recent call last):
  File "setup.py", line 17, in <module>
    metadata, options = get_config()
  File "/Users/jackey/Downloads/MySQL-python-1.2.5/setup_posix.py", line 43, in get_config
    libs = mysql_config("libs_r")
  File "/Users/jackey/Downloads/MySQL-python-1.2.5/setup_posix.py", line 25, in mysql_config
    raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: /usr/local/bin/mysql_config not found

解决办法:

export DYLD_LIBRARY_PATH="/usr/local/mysql/lib"

然后又出现这个错误

_mysql.c:44:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
         ^~~~~~~~~~~~~
1 error generated.
error: command 'cc' failed with exit status 1

解决办法:

brew install mysql
brew unlink mysql
brew install mysql-connector-c
sudo sed -i -e 's/libs="$libs -l "/libs="$libs -lmysqlclient -lssl -lcrypto"/g' /usr/local/mysql/bin/mysql_config

 

相关文章:

  • 2021-06-09
  • 2021-12-13
  • 2022-01-22
  • 2022-02-08
  • 2022-03-04
  • 2022-02-08
  • 2022-12-23
  • 2021-12-27
猜你喜欢
  • 2021-06-26
  • 2021-06-01
  • 2021-10-11
  • 2022-12-23
  • 2021-12-04
  • 2021-10-21
  • 2021-04-20
相关资源
相似解决方案