解决Python 3安装gevent时遇到的gcc编译错误

python3 安装gevent报错 GCC error, 按照网上大哥们的指导把,配套的库全部安装一遍后,问题依然没有解决,但是这个些如果没有安装的还是需要进行下安装:

yum install libevent-devel

yum install python devel

yum install python-gevent   

我的操作系统是centos7.6 于是尝试升级了下pip3到最新版本,然后进行gevent的安装就成功了:

python3 -m pip install –upgrade pip

pip3 install gevent==1.4.0

src/greenlet/greenlet_refs.hpp:179:19: warning: inline function ‘T* greenlet::refs::PyObjectPointer<T, <anonymous> >::borrow() const [with T = _greenlet; void (* TC)(void*) = greenlet::refs::GreenletChecker]’ used but never defined [enabled by default]
             inline T* borrow() const G_NOEXCEPT
                       ^
    error: command 'gcc' failed with exit status 1

    —————————————-
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4fy1i1hg/greenlet/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-i_ykhstc-record/install-record.txt –single-version-externally-managed –compile" failed with error code 1 in /tmp/pip-build-4fy1i1hg/greenlet/
[root@mongo_server01 tools]# python3 -m pip install –upgrade pip
WARNING: Running pip install with root privileges is generally not a good idea. Try `__main__.py install –user` instead.
Collecting pip
  Downloading https://files.pythonhosted.org/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2420f8b/pip-21.3.1-py3-none-any.whl (1.7MB)
    100% |████████████████████████████████| 1.7MB 675kB/s
Installing collected packages: pip
Successfully installed pip-21.3.1
You are using pip version 21.3.1, however version 22.3.1 is available.
You should consider upgrading via the 'pip install –upgrade pip' command.
[root@mongo_server01 tools]# pip3 install gevent==1.4.0
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Collecting gevent==1.4.0
  Using cached gevent-1.4.0-cp36-cp36m-manylinux1_x86_64.whl (5.5 MB)
Collecting greenlet>=0.4.14
  Downloading greenlet-2.0.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (513 kB)
     |████████████████████████████████| 513 kB 1.0 MB/s
Installing collected packages: greenlet, gevent
Successfully installed gevent-1.4.0 greenlet-2.0.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
[root@mongo_server01 tools]# pip3 list
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Package        Version
————– ——-
gevent         1.4.0
greenlet       2.0.1
logger         1.4
numpy          1.19.5
pip            21.3.1
psutil         5.8.0
setuptools     39.2.0
zope.event     4.5.0
zope.interface 5.5.1
[root@mongo_server01 tools]#

物联沃分享整理
物联沃-IOTWORD物联网 » 解决Python 3安装gevent时遇到的gcc编译错误

发表评论