时间:2021-07-01 10:21:17 帮助过:2人阅读
>>Sudo apt-get install mysql-client
2。安装MySQL-python
要想使python可以操作mysql 就需要MySQL-python驱动,它是python 操作mysql必不可少的模块。
>>sudo easy_install MySQL-python
3。安装遇到的问题。
1)
EnvironmentError: mysql_config not found
解决方法:因为mysql_config是属于MySQL开发用的文件,而使用apt-get安装的MySQL是没有这个文件的,于是在包安装器里面寻找:sudo apt-get install libmysqld-dev
2)
In [1]: import MySQLdb
/usr/lib/python2.7/dist-packages/pkg_resources.py:1031: UserWarning: /home/yeming/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).warnings.warn(msg, UserWarning)
解决方法
进入 /home/yeming/
chmod g-wx,o-wx .python-eggs/
修改下权限就好了。
python使用mysql数据库(1)
标签: