Centos 6-sudo不';安装mysqlclient for Python 3.4时无法识别pip3.4

Centos 6-sudo不';安装mysqlclient for Python 3.4时无法识别pip3.4,python,linux,Python,Linux,我不熟悉Centos 6和Linux我需要安装Python3.4,但是Centos 6默认安装了Python2.6.6。 我已将Python3.4安装到/usr/local/lib/Python3.4 但是,我在安装mysqlclient时遇到问题 我尝试了pip3.4安装mysqlclient。 这是错误消息 错误 _mysql.c:29:23: error: my_config.h: No such file or directory _mysql.c:30:19: error: mysql

我不熟悉
Centos 6
Linux

我需要安装
Python3.4
,但是
Centos 6
默认安装了
Python2.6.6

我已将
Python3.4
安装到
/usr/local/lib/Python3.4


但是,我在安装
mysqlclient
时遇到问题

我尝试了
pip3.4安装mysqlclient

这是错误消息

错误

_mysql.c:29:23: error: my_config.h: No such file or directory
_mysql.c:30:19: error: mysql.h: No such file or directory
_mysql.c:31:26: error: mysqld_error.h: No such file or directory
_mysql.c:51:20: error: errmsg.h: No such file or directory
_mysql.c:74: error: expected specifier-qualifier-list before ‘MYSQL
_mysql.c:88: error: expected specifier-qualifier-list before ‘MYSQL_RES’
_mysql.c: In function ‘_mysql_Exception’:
_mysql.c:128: warning: implicit declaration of function ‘mysql_errno’
_mysql.c:128: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:131: error: ‘CR_MAX_ERROR’ undeclared (first use in this function)
_mysql.c:131: error: (Each undeclared identifier is reported only once
_mysql.c:131: error: for each function it appears in.)
_mysql.c:139: error: ‘CR_COMMANDS_OUT_OF_SYNC’ undeclared (first use in this function)
_mysql.c:140: error: ‘ER_DB_CREATE_EXISTS’ undeclared (first use in this function)
_mysql.c:141: error: ‘ER_SYNTAX_ERROR’ undeclared (first use in this function)
_mysql.c:142: error: ‘ER_PARSE_ERROR’ undeclared (first use in this function)
_mysql.c:143: error: ‘ER_NO_SUCH_TABLE’ undeclared (first use in this function)
_mysql.c:144: error: ‘ER_WRONG_DB_NAME’ undeclared (first use in this function)
_mysql.c:145: error: ‘ER_WRONG_TABLE_NAME’ undeclared (first use in this function)
_mysql.c:146: error: ‘ER_FIELD_SPECIFIED_TWICE’ undeclared (first use in this function)
_mysql.c:147: error: ‘ER_INVALID_GROUP_FUNC_USE’ undeclared (first use in this function)
_mysql.c:148: error: ‘ER_UNSUPPORTED_EXTENSION’ undeclared (first use in this function)
_mysql.c:149: error: ‘ER_TABLE_MUST_HAVE_COLUMNS’ undeclared (first use in this function)
_mysql.c:178: error: ‘ER_DUP_ENTRY’ undeclared (first use in this function)
_mysql.c:221: warning: implicit declaration of function ‘mysql_error’
_mysql.c:221: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c: In function ‘_mysql_server_init’:
_mysql.c:325: warning: label ‘finish’ defined but not use
_mysql.c:242: warning: unused variable ‘item’
_mysql.c:241: warning: unused variable ‘groupc'
_mysql.c:241: warning: unused variable ‘i’
...

error: command 'gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/local/bin/python3.4 -c "import setuptools, tokenize;__file__=
'/tmp/pip_build_username/mysqlclient/setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" 
install --record /tmp/pip-s1b9rgku-record/install-record.txt 
--single-version-externally-managed --compile failed with error code 1 
in /tmp/pip_build_username/mysqlclient
        Storing debug log for failure in /home/username/.pip/pip.log
编辑:找出问题所在。Sudo不认识pip3.4。此链接有助于:


您是否先安装了mysqlclient(rpm)?听起来好像找不到它需要的标题

sudo-yum安装mysql-devel-mysql-lib


请参见

Hi,您能否指出/home/username/.pip/pip.log日志文件包含的内容?在“错误:命令“gcc”失败,退出状态为1”之前是否有任何内容?@scytale-有一个很长的列表,但这是它的一部分,直到“…”为止,其余的是一堆消息,抱怨它找不到成员或初始化错误。您是否先安装了mysqlclient(rpm)?听起来它好像找不到它需要的头。我试过了,但它仍然抱怨在我运行脚本时找不到MySQLdb模块。每当我尝试使用pip3.4安装任何软件包时,它都不起作用。是否有用于python 3的mysqldb模块?对于Python3,我使用mysql连接器(因为它没有任何依赖项-不需要安装mysql)。sudo pip安装-允许外部mysql连接器python mysql连接器python然后导入mysql.connector然后其余调用几乎相同请参见是的,它是mysqlclient。同样的脚本在Windows环境中也可以正常工作。我不得不将脚本迁移到linux服务器进行测试。如果我使用pip安装mysqlclient-它安装到python 2.6.6,如果我使用“sudo pip3.4安装mysqlclient”-它会抱怨它无法识别pip3.4。尝试过sudo pip3安装吗?还是和sudopip3.4一样?python3.4是否安装了pip?是的,应该安装。我可以在/usr/local/bin中看到pip3.4。我甚至添加了-export PATH=“/usr/local/bin:$PATH”。我刚试过SudoPip3,但它一点也认不出来。
sudo /usr/local/bin/pip3.4 install mysqlclient