gpt4 book ai didi

python - Centos 6 - sudo 在为 Python 3.4 安装 mysqlclient 时无法识别 pip3.4

转载 作者:可可西里 更新时间:2023-11-01 11:45:43 24 4
gpt4 key购买 nike

我是 Centos 6Linux 的新手。
我需要安装 Python 3.4 但是 Centos 6 默认为 Python 2.6.6
我已经安装Python 3.4/usr/local/lib/Python3.4

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

我试过 pip3.4 install 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。此链接有帮助:Installing Python3.4 and the SciPy stack on CentOS

sudo /usr/local/bin/pip3.4 install mysqlclient 

最佳答案

你有没有先安装mysqlclient (rpm)?听起来它找不到它需要的标题

sudo yum install mysql mysql-devel mysql-lib

参见 http://www.cyberciti.biz/faq/centos-linux-56-install-mysql-client-only/

关于python - Centos 6 - sudo 在为 Python 3.4 安装 mysqlclient 时无法识别 pip3.4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32134826/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com