如何使用pip安装Python MySQLdb模块? [英] How to install Python MySQLdb module using pip?
本文介绍了如何使用pip安装Python MySQLdb模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用pip为Python安装 MySQLdb 模块?
How can I install the MySQLdb module for Python using pip?
推荐答案
这很容易,但是很难记住正确的拼写:
It's easy to do, but hard to remember the correct spelling:
pip install mysqlclient
如果您需要1.2.x版本(仅适用于旧版Python),请使用pip install MySQL-python
If you need 1.2.x versions (legacy Python only), use pip install MySQL-python
注意:运行上述命令时,某些依赖项可能必须存在.有关如何在各种平台上安装它们的一些提示:
Note: Some dependencies might have to be in place when running the above command. Some hints on how to install these on various platforms:
sudo apt-get install python-pip python-dev libmysqlclient-dev
Fedora 24:
sudo dnf install python python-devel mysql-devel redhat-rpm-config gcc
Mac OS
brew install mysql-connector-c
如果失败,请尝试
brew install mysql
这篇关于如何使用pip安装Python MySQLdb模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文