zoukankan      html  css  js  c++  java
  • pyenv 2.7 环境安装MySQL-python ERROR

     ERROR: Command errored out with exit status 1:
         command: /root/.pyenv/versions/2.7.18/envs/env27/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ULsldh/MySQL-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ULsldh/MySQL-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
    '"'"', '"'"'
    '"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-aa7Smo/install-record.txt --single-version-externally-managed --compile --install-headers /root/.pyenv/versions/2.7.18/envs/env27/include/site/python2.7/MySQL-python
             cwd: /tmp/pip-install-ULsldh/MySQL-python/
        Complete output (30 lines):
        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 -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/root/.pyenv/versions/2.7.18/envs/env27/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
        _mysql.c:44:10: fatal error: my_config.h: No such file or directory
           44 | #include "my_config.h"
              |          ^~~~~~~~~~~~~
        compilation terminated.
        error: command 'gcc' failed with exit status 1
        ----------------------------------------
    ERROR: Command errored out with exit status 1: /root/.pyenv/versions/2.7.18/envs/env27/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ULsldh/MySQL-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ULsldh/MySQL-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
    '"'"', '"'"'
    '"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-aa7Smo/install-record.txt --single-version-externally-managed --compile --install-headers /root/.pyenv/versions/2.7.18/envs/env27/include/site/python2.7/MySQL-python Check the logs for full command output.

    解决办法

    apt install libmysqlclient-dev
    ln -s /usr/include/mysql/mysql.h /usr/include/mysql/my_config.h
  • 相关阅读:
    Zookeeper系列二:分布式架构详解、分布式技术详解、分布式事务
    Zookeeper系列一:Zookeeper介绍、Zookeeper安装配置、ZK Shell的使用
    Mysql系列九:使用zookeeper管理远程Mycat配置文件、Mycat监控、Mycat数据迁移(扩容)
    Mysql系列八:Mycat和Sharding-jdbc的区别、Mycat分片join、Mycat分页中的坑、Mycat注解、Catlet使用
    Mysql系列七:分库分表技术难题之分布式全局唯一id解决方案
    Mysql系列五:数据库分库分表中间件mycat的安装和mycat配置详解
    学习Mysql过程中拓展的其他技术栈:Docker入门介绍
    学习Mysql过程中拓展的其他技术栈:设置linux虚拟机的固定ip和克隆linux虚拟机
    Mysql系列四:数据库分库分表基础理论
    Mysql系列三:Centos6下安装Mysql和Mysql主从复制的搭建
  • 原文地址:https://www.cnblogs.com/liangliangzz/p/15515592.html
Copyright © 2011-2022 走看看