1.安装pybind
git clone https://github.com/pybind/pybind11.git
cd pybind11
mkdir build
cd build
cmake -DPYBIND11_TEST=OFF -DCMAKE_INSTALL_PREFIX="\where\to\install\pybind11" .. -G"Visual Studio 15 2017" -A x64
cmake --install .
2.安装libjpeg和zlib
conda install -c conda-forge libjpeg-turbo
conda install -c anaconda zlib
3.在torchvision源文件
cmake -DCMAKE_PREFIX_PATH="F:\pytroch\libtorch-win-shared-with-deps-1.8.0+cpu\libtorch;C:\where\to\install\pybind11" .. -DCMAKE_INSTALL_PREFIX="F:\pytroch\torchvision" -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 15 2017" -A x64
cmake --build . --config Release -- /m