MySQLdb 安装小结
[root@localhost ~]# pip install MySQL-python
Collecting MySQL-python
Downloading MySQL-python-1.2.5.zip (108kB)
100% |████████████████████████████████| 112kB 104kB/s
Complete output from command python setup.py egg_info:
sh: mysql_config: 未找到命令
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-uqVxKc/MySQL-python/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "setup_posix.py", line 25, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-uqVxKc/MySQL-python/
You are using pip version 8.1.2, however version 9.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
出现如上报错信息
解决过程如下:
yum -y install mysql-devel
再次尝试安装
[root@localhost ~]# 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 ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-1pIb1q/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-B1EPP_-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
unable to execute gcc: No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-1pIb1q/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-B1EPP_-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-1pIb1q/MySQL-Python/
再解决
yum install gcc
再尝试
[root@localhost ~]# 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 ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-JG4sHg/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-XFpL1e-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
_mysql.c:29:20: 致命错误:Python.h:没有那个文件或目录
#include "Python.h"
^
编译中断。
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-JG4sHg/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-XFpL1e-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-JG4sHg/MySQL-Python/
再尝试解决
yum install python-devel
yum install libevent-devel
pip install gevent
这次终于解决了
[root@localhost ~]# 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
Successfully installed MySQL-Python-1.2.5
MySQLdb 安装小结相关推荐
- PYTHON -MYSQLDB安装遇到的问题和解决办法
PYTHON -MYSQLDB安装遇到的问题和解决办法 参考文章: (1)PYTHON -MYSQLDB安装遇到的问题和解决办法 (2)https://www.cnblogs.com/gaoshanx ...
- RHEL5 kickstart 安装小结
RHEL5 kickstart 安装小结 环境简介 系统版本:RHEL5 32位 内核版本:2.6.18-8.el5 i686 系统所需服务:tftp.dhcp.ftp.yum 创建ftp [root ...
- suse linux 硬盘安装,SUSE硬盘安装小结
SUSE硬盘安装小结 发布时间:2007-07-16 21:55:02来源:红联作者:CaineLine 和Slack安装一样,这篇也是我安装SUSE时从网上下的,然后放到一块,相互比较学习,这样理解 ...
- winpython是个坑_Win10 Python MySQLdb安装爬的坑
先报一下环境:win10 python2.7 先前安装了Anaconda,然后安装了pyCharm. 安装的包 MySQL-python-1.2.4b4.win32-py2.7.exe pyCharm ...
- python mysqldb安装_解决centos7 安装MySQLdb-python 报错 方案
运行 pip install MySQL-Python 报错: 云服务器 Command python setup.py egg_info failed with error code 1 in 继续 ...
- python mysqldb安装_Flask干货:访问数据库——Python数据库框架MySQLPython
图 | 源网络文 | 5号程序员 上一次我们学会了数据库安装,但只是安装好没教大家怎么使用! 嘿,别担心,这不有我呢嘛. 今天就由我给大家介绍介绍框架MySQL-Python. 01 MySQL-Py ...
- MySQLdb安装与使用
一.MAC系统 1. 安装(使用pip命令) [1]使用 easy_install pip命令安装pip [2]安装成功,输入pip显示用法.命令行等信息:命令 which pip 可以查看安装位置 ...
- mysqldb安装过程
python脚本中引入了mysqldb库,但是对应的服务器上又没装这个库,又不能在线安装,只能进行离线安装 安装的环境为centos7和centos6,python2.7和python2.6都可以安装 ...
- KEIL5.11安装小结
一.注意点 1.安装路径不能带中文,必须是英文路径 2.安装目录不能跟 51 的 KEIL 或者 KEIL4 冲突,三者目录必须分开 3.KEIL5 不像 KEIL4 那样自带了很多厂商的 MCU 型 ...
- Linux软件安装小结
一.Linux中软件安装的方式 在Linux中一切皆文件,软件都是由源码编译生成的二进制文件.因此在Linux中安装软件有多种方式,一种是使用软件管理器安装软件,二是使用前端软件管理器安装,三是自行编 ...
最新文章
- 经典游戏大合集,你的青春也许就在里面!
- linux 内核线程与普通进程的区别
- 质量兴农战略规划-农业大健康·韩长赋:质量效益和竞争力
- Kubernetes1.8.4安装指南 -- 1. 环境准备
- java课外兴趣小组管理系统_课外兴趣小组活动方案
- 【Java】JDK8新特性之函数式接口
- java 接口 方法的 不同_Java – 使用相同的方法和不同的返回类型实现多个接口...
- Linux yum安装
- android多个网络请求如何依次执行,Android 并发和串行网络请求
- 全球及中国分布式光纤传感(DFOS)行业动态及十四五前景预测报告2022-2027
- 最新AxureUX WEB端交互原型通用组件模板库 组件仍然是这套作品的核心内容,这套作品的组件由通用组件、数据录入、数据展示、信息反馈
- 【Pix4d精品教程】Pix4dmapper航测内业项目化数据处理完整流程(空三、生成点云、DOM和DSM)
- 数据恢复哪家强?四大数据恢复类软件评测
- 单片机 取模软件:字模提取v2.1、PCtoLCD下载
- mysql .ibd_MySQL单表ibd文件恢复方法详解
- 软件设计师---软件工程
- org.apache.thrift.transport.TTransportException: SASL authentication not complete
- fuz 1205(小鼠迷宫问题)
- udf,udaf,udtf区别与联系
- Unirech阿里云国际版云服务器ecs的应用场景有哪些?