I have built pytorch with cc 3.5 and this works for me. Then I built a whl file “torch-1.6.0a0+ 31f58d-cp37-cp37m-win_amd64.whl”, but it does not contain CUDA.
How to build a .whl like the official one?
I followed these steps:
First I installed Visual Studio 2017 with the toolset 14.11.
Then I installed CUDA 9.2 and cuDNN v7.
Clone PyTorch Source:
git clone --branch release/1.6 https://github.com/pytorch/pytorch.git pytorch-1.6
cd pytorch-1.6
git submodule sync
git submodule update --init --recursive

In Anaconda Prompt:
conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi

set USE_NINJA=OFF
set CMAKE_GENERATOR=Visual Studio 15 2017
set CMAKE_GENERATOR_TOOLSET_VERSION=14.11
set DISTUTILS_USE_SDK=1

for /f "usebackq tokens=*" %i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version [15^,16^) -products * -latest -property installationPath`) do call "%i\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=%CMAKE_GENERATOR_TOOLSET_VERSION%

set TORCH_CUDA_ARCH_LIST=3.5

python setup.py install

After 5 hours, the build process was completed successfully. Then I built whl:
python setup.py bdist_wheel

I got whl in a few minutes. I installed this wheel in a separate conda environment and tested it.
(test-whl) E:\PyTorchSource>pip install pytorch-1.6\dist\torch-1.6.0a0+b31f58d-cp37-cp37m-win_amd64.whl

(test-whl) E:\PyTorchSource>conda list
# packages in environment at C:\Users\qwego\Anaconda3\envs\test-whl:
#
# Name                    Version                   Build  Channel
ca-certificates           2021.10.26           haa95532_2
certifi                   2021.10.8        py37haa95532_0
future                    0.18.2                   pypi_0    pypi
numpy                     1.21.4                   pypi_0    pypi
openssl                   1.1.1l               h2bbff1b_0
pip                       21.2.4           py37haa95532_0
python                    3.7.11               h6244533_0
setuptools                58.0.4           py37haa95532_0
sqlite                    3.36.0               h2bbff1b_0
torch                     1.6.0a0+b31f58d          pypi_0    pypi
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
wheel                     0.37.0             pyhd3eb1b0_1
wincertstore              0.2              py37haa95532_2

(test-whl) E:\PyTorchSource>python
Python 3.7.11 (default, Jul 27 2021, 09:42:29) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> print(torch.cuda.get_arch_list())
['sm_35']
>>> torch.tensor([1.0, 2.0]).cuda()
tensor([1., 2.], device='cuda:0')
>>>

This works on my computer, but I would like to get an independent whl.