在mac、centos、ubuntu下,对安装python模块时,出现了各种问题,对其进行一一解决。
问题1、OSError: mysql_config not found
解答: 由于未安装mysql的模块,因此需要安装
mac:
brew install mysql
find / -name mysql_config
echo 'export PATH=$PATH:/usr/local/Cellar/mysql/8.0.22_1/bin/' >> ~/.bash_profile
centos:
yum install mysql-devel gcc gcc-devel python3-devel -y
ubuntu:
apt-get install libmysqlclient-dev -y
问题2、c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
解答: 由于未安装cryptography的模块,因此需要安装
ubuntu
apt-get install libssl-dev libffi-dev libcrypto++-dev build-essential -y
问题3、Failed to build cryptography
解答: ubuntu下,若还没有解决,假设cryptography==3.1.1,则将版本降低为 cryptography==3,可能是版本过高导致的问题
问题4:dyld: Library not loaded: /usr/local/Cellar/python@3.7/3.7.5/Frameworks/Python.framework/Versions/3.7/Python
Referenced from: /Users/c4rt1y/Documents/env/python3/bin/python
Reason: image not found
解答:安装软件的时候,python自动升级,最简单的办法,替换版本
cp /usr/local/Cellar/python\@3.7/3.7.6/Frameworks/Python.framework/Versions/3.7/bin/python3 /usr/local/bin/python
cp /usr/local/Cellar/python\@3.7/3.7.6/Frameworks/Python.framework/Versions/3.7/bin/pip3 /usr/local/bin/pip
cp /usr/local/Cellar/python\@3.7/3.7.6/Frameworks/Python.framework/Versions/3.7/bin/pip3 /usr/local/bin/pip3
https://www.cnblogs.com/njj10/p/7676123.html
https://blog.csdn.net/py0312/article/details/90729108
https://stackoverflow.com/questions/35144550/how-to-install-cryptography-on-ubuntu
https://blog.csdn.net/qq_41672744/article/details/88114507