python - Mac 安装 MySQLdb时 报错,所有过程都按照网上说的做的,还是报错,求大神帮助
高洛峰
高洛峰 2017-04-18 10:28:26
0
3
466

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(3)
Peter_Zhu

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

  1. pip2 install MySQL-python

nano ~/.profile
source ~/.profile
pip install mysqlclient

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!