0

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

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
4

1 回答 1

0

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

NO_CUDA=1 MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++  python setup.py install
于 2017-04-26T17:05:03.750 回答