博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何解决pip install Twisted时出错: limits.h: No such file or directory
阅读量:6800 次
发布时间:2019-06-26

本文共 3144 字,大约阅读时间需要 10 分钟。

Environment: macOS mojave - 10.14.1; python 2.7.15/python 3.7.1.

在使用pip安装Twisted库时出现以下错误:

In file included from /usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.1.0/include-fixed/syslimits.h:7:0,                 from /usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.1.0/include-fixed/limits.h:34,                 from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:19,                 from src/twisted/test/raiser.c:4:/usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.1.0/include-fixed/limits.h:194:15: fatal error: limits.h: No such file or directory #include_next 
/* recurse down to the real one */ ^~~~~~~~~~compilation terminated.error: Setup script exited with error: command 'gcc' failed with exit status 1

在网上搜了很久,仅发现针对linux的解决方案。没有人提到macOS。

在一番研究后,发现macOS mojave的update故意删除了/user/include。于是想到是否因为/usr/include不存在了,所以pip找不到limit.h了呢。

于是执行了下面这行命令,重新手动恢复/usr/include文件夹。

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

可以看到/usr/include文件夹被恢复了。

在这之后再执行

pip install Twisted

结果显示successfully installed:

Collecting twisted  Using cached https://files.pythonhosted.org/packages/5d/0e/a72d85a55761c2c3ff1cb968143a2fd5f360220779ed90e0fadf4106d4f2/Twisted-18.9.0.tar.bz2Requirement already satisfied: zope.interface>=4.4.2 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from twisted) (4.6.0)Requirement already satisfied: constantly>=15.1 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from twisted) (15.1.0)Requirement already satisfied: incremental>=16.10.1 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from twisted) (17.5.0)Requirement already satisfied: Automat>=0.3.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from twisted) (0.7.0)Requirement already satisfied: hyperlink>=17.1.1 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from twisted) (18.0.0)Requirement already satisfied: PyHamcrest>=1.9.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from twisted) (1.9.0)Requirement already satisfied: attrs>=17.4.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from twisted) (18.2.0)Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from zope.interface>=4.4.2->twisted) (39.0.1)Requirement already satisfied: six in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from Automat>=0.3.0->twisted) (1.11.0)Requirement already satisfied: idna>=2.5 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from hyperlink>=17.1.1->twisted) (2.7)Building wheels for collected packages: twisted  Running setup.py bdist_wheel for twisted ... done  Stored in directory: /Users/Mescetina/Library/Caches/pip/wheels/57/2e/89/11ba83bc08ac30a5e3a6005f0310c78d231b96a270def88ca0Successfully built twisted

苹果macOS 10.14的更新去除了/usr/include,导致pip找不到header文件,从而阻止了Twisted库的安装。希望我的solution能帮到大家。

转载地址:http://jnywl.baihongyu.com/

你可能感兴趣的文章
Vue插件从封装到发布
查看>>
扒一扒我们生活中常见的品牌小程序
查看>>
使用注解干掉大量if else和switch
查看>>
【本人秃顶程序员】实战并发-使用分布式缓存和有限状态机
查看>>
[MySQL光速入门]019 分别使用loop, while, repeat 来计算 从0加到100 答案
查看>>
浅析libuv源码-node事件轮询解析(2)
查看>>
区块链软件公司:区块链技术去中心化
查看>>
Python爬虫的基本概念、分类、学习路线以及爬取数据思路
查看>>
BCH或许才是真正的未来
查看>>
python编程:从入门到实践学习笔记-函数
查看>>
SpringBoot使用Nacos配置中心
查看>>
Java四种线程池的使用
查看>>
Go学习系列——第一个 Go程序
查看>>
关于ntp时间同步理论及配置参数-20170804
查看>>
loadrunner 脚本开发-int型变量和字符串的相互转换
查看>>
为什么运行NOVA命令总要报一个DEBUG,没找到原因,路过的大侠一起看看啊
查看>>
北电ERS1600,8300,8600交换机的基本技术-第十章接口高级特征
查看>>
我的友情链接
查看>>
20170830L08-06老男孩linux实战运维培训-Lamp系列之-Apache服务生产实战应用指南03
查看>>
我的友情链接
查看>>