Look at the readme: https://github.com/pytorch/pytorch#install-pytorch 117
We specify: MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install for OSX. Particularly, MACOSX_DEPLOYMENT_TARGET=10.9 is important and will fix your error.