The problem with my Python2.7 when installing MySQLdb is because I don’t have MySQL on my machine. I finally installed it brew install mysql, but the error seems to be different from yours... You can try it
export PATH=/usr/local/mysql/bin:$PATH export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/ Save and exit, here I am ctrl + O (save), then Enter (very important), ctrl + X (exit), this editor is such a pain in the ass
python3
使用pymysql
pip install pymysql
The problem with my Python2.7 when installing MySQLdb is because I don’t have MySQL on my machine. I finally installed it
brew install mysql
, but the error seems to be different from yours... You can try it*
nano ~/.profile
Write the following content
export PATH=/usr/local/mysql/bin:$PATH
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
Save and exit, here I am ctrl + O (save), then Enter (very important), ctrl + X (exit), this editor is such a pain in the ass
Execute code
source ~/.profile
Install MySQLdb
pip2 install MySQL-python
nano ~/.profile
source ~/.profile
pip install mysqlclient