python-MySQLdb接口程序安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python-MySQLdb接口程序安装相关的知识,希望对你有一定的参考价值。
centos 7,python2.7 安装python-MySQLdb,因是最小化安装,安装过程中需要依赖其他的工具或包
[[email protected] ~]# pipinstall mysql-python
报错:Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-Gme83P/mysql-python/
通过yum 安装以下两个包;
[[email protected] ~]# yum install mysql-devel
[[email protected] ~]# yum installpython-devel
再执行安装,出现以下报错,需要安装gcc编译工具,
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__=‘/tmp/pip-build-U2yiQI/mysql-python/setup.py‘;f=getattr(tokenize, ‘open‘, open)(__file__);code=f.read().replace(‘\r\n‘, ‘\n‘);f.close();exec(compile(code, __file__, ‘exec‘))" install --record /tmp/pip-iogwbL-record/install-record.txt --single-version-externally-managed --compile"failed with error code 1 in /tmp/pip-build-U2yiQI/mysql-python/
[[email protected] ~]#yum install gcc
安装pip需要先装setuptools
https://pypi.python.org/pypi/setuptools
[[email protected] setuptools-36.0.1]# pip install mysql-python
Collecting mysql-python
Using cached MySQL-python-1.2.5.zip
Installing collected packages: mysql-python
Running setup.py install for mysql-python ... done
本文出自 “没有你的城市” 博客,谢绝转载!
以上是关于python-MySQLdb接口程序安装的主要内容,如果未能解决你的问题,请参考以下文章
centos7 使用pip安装python-mysqldb模块出现的问题:
如何在 Ubuntu 20.04 (Focal Fossa) 中为 Python 2.7 安装 python-mysqldb?