编译pytorch时出错:';cstdint';找不到文件

编译pytorch时出错:';cstdint';找不到文件,pytorch,Pytorch,我试图在Mac OS X上使用NO_CUDA=1 python setup.py install编译pytorch,但我遇到以下错误: In file included from /Users/ezyang/Dev/pytorch-tmp/torch/lib/tmp_install/include/THPP/Tensor.hpp:3: /Users/ezyang/Dev/pytorch-tmp/torch/lib/tmp_install/include/THPP/Storage.hpp:6:10

我试图在Mac OS X上使用
NO_CUDA=1 python setup.py install
编译pytorch,但我遇到以下错误:

In file included from /Users/ezyang/Dev/pytorch-tmp/torch/lib/tmp_install/include/THPP/Tensor.hpp:3:
/Users/ezyang/Dev/pytorch-tmp/torch/lib/tmp_install/include/THPP/Storage.hpp:6:10: fatal error: 
      'cstdint' file not found
#include <cstdint>
         ^
1 error generated.
In file included from torch/csrc/autograd/functions/init.cpp:2:
In file included from torch/csrc/autograd/functions/batch_normalization.h:4:
In file included from /Users/ezyang/Dev/pytorch-tmp/torch/lib/tmp_install/include/THPP/THPP.h:4:
/Users/ezyang/Dev/pytorch-tmp/torch/lib/tmp_install/include/THPP/Storage.hpp:6:10: fatal error: 
      'cstdint' file not found
#include <cstdint>
         ^
1 error generated.
1 error generated.
1 error generated.
1 error generated.
In file included from torch/csrc/autograd/python_hook.cpp:5:
In file included from /Users/ezyang/Dev/pytorch-tmp/torch/csrc/THP.h:32:
/Users/ezyang/Dev/pytorch-tmp/torch/csrc/utils.h:6:10: fatal error: 
      'type_traits' file not found
#include <type_traits>
         ^
13 errors generated.
1 error generated.
1 error generated.
error: command 'gcc' failed with exit status 1
在/Users/ezyang/Dev/pytorch-tmp/torch/lib/tmp_install/include/THPP/Tensor.hpp中包含的文件中:3:
/Users/ezyang/Dev/pytorch-tmp/torch/lib/tmp_-install/include/THPP/Storage.hpp:6:10:致命错误:
找不到“cstdint”文件
#包括
^
生成1个错误。
在torch/csrc/autograd/functions/init.cpp中包含的文件中:2:
包含在torch/csrc/autograd/functions/batch_normalization.h:4中的文件中:
在/Users/ezyang/Dev/pytorch-tmp/torch/lib/tmp_install/include/THPP/THPP.h中包含的文件中:4:
/Users/ezyang/Dev/pytorch-tmp/torch/lib/tmp_-install/include/THPP/Storage.hpp:6:10:致命错误:
找不到“cstdint”文件
#包括
^
生成1个错误。
生成1个错误。
生成1个错误。
生成1个错误。
在torch/csc/autograd/python_hook.cpp中包含的文件中:5:
文件包括在/Users/ezyang/Dev/pytorch-tmp/torch/csc/THP.h:32中:
/Users/ezyang/Dev/pytorch-tmp/torch/csc/utils.h:6:10:致命错误:
找不到“type_traits”文件
#包括
^
产生了13个错误。
生成1个错误。
生成1个错误。
错误:命令“gcc”失败,退出状态为1

您需要设置环境变量,让Python在OS X上使用正确的C编译器。您应该这样做:

NO_CUDA=1 MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++  python setup.py install