美文网首页
阿里云centos7安装twisted报错-解决方案

阿里云centos7安装twisted报错-解决方案

作者: uniqueway | 来源:发表于2017-12-06 10:57 被阅读0次

    使用命令:

    pip install twisted

    发现了如下错误:

    src/twisted/test/raiser.c:4:20: 致命错误:Python.h:没有那个文件或目录

    #include "Python.h"

    ^

    编译中断。

    error: command 'gcc' failed with exit status 1

    红色部分出错提示:

    Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-mUmfzz/twisted/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-77C8__-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-mUmfzz/twisted/

    网上查找了一下,初步判断应该是缺少依赖包,执行如下命令:

    yum install python-devel

    然后再次安装 pip install twisted

    安装完成如下提示:

    Requirement already satisfied: zope.interface>=3.6.0 in /usr/lib64/python2.7/site-packages (from twisted)

    Requirement already satisfied: constantly>=15.1 in /usr/lib/python2.7/site-packages (from twisted)

    Requirement already satisfied: incremental>=16.10.1 in /usr/lib/python2.7/site-packages (from twisted)

    Requirement already satisfied: Automat>=0.3.0 in /usr/lib/python2.7/site-packages (from twisted)

    Requirement already satisfied: hyperlink>=17.1.1 in /usr/lib/python2.7/site-packages (from twisted)

    Requirement already satisfied: setuptools in /usr/lib/python2.7/site-packages (from zope.interface>=3.6.0->twisted)

    Requirement already satisfied: attrs in /usr/lib/python2.7/site-packages (from Automat>=0.3.0->twisted)

    Requirement already satisfied: six in /usr/lib/python2.7/site-packages (from Automat>=0.3.0->twisted)

    Installing collected packages: twisted

    Running setup.py install for twisted ... done

    Successfully installed twisted-17.9.0

    但是为啥是python2.7,我是3.6.3。还是继续再研究一下。

    相关文章

      网友评论

          本文标题:阿里云centos7安装twisted报错-解决方案

          本文链接:https://www.haomeiwen.com/subject/majkixtx.html