背景

在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

Logo

鸿蒙生态一站式服务平台。

更多推荐