本机环境为CentOS 6.7 32 位,Python 2.7.6,因为打算使用将scrapy爬取的数据存入MySQL数据库,谁知Python连接MySQL的时候报错,导入MySQLdb模块报错:
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
ImportError: No module named MySQLdb
#查看系统版本
# lsb_release -a
LSB Version: :base-4.0-ia32:base-4.0-noarch:core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.7 (Final)
Release: 6.7
Codename: Final
安装过程:
#sudo yum install gcc
#sudo yum install python-devel
#sudo yum install mysql-devel
#sudo yum install pip-python
#pip install mysql-python
更多原创文章请移步http://jinbitou.net(金笔头博客)