fatal error C1083: 无法打开包括文件: “unistd.h”: No such file or directory

背景

在Windows上源码编译PyBullet,参考Windows Install PyBullet,命令很简单,如下:

git clone https://github.com/bulletphysics/bullet3
or download and unzip https://github.com/bulletphysics/bullet3/archive/master.zip and then:
cd bullet3
python setup.py build
python setup.py install

但是在执行python setup.py build时报错:

D:\bullet3\examples\ThirdPartyLibs\zlib\gzguts.h(23): fatal error C1083: 无法打开包括文件: “unistd.h”: No such file or directory

error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2  

解决方案

  1. 用编辑器(如记事本)打开bullet3\examples\ThirdPartyLibs\zlib\gzguts.h文件
  2. 注释掉#include <unistd.h>
  3. 添加:
#include <io.h>
#include <process.h>
  1. 保存即可

参考

[1] https://stackoverflow.com/questions/22705751/cannot-open-include-file-unistd-h-no-such-file-or-directory
[2] https://www.cnblogs.com/dongling/p/7267784.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值