打开命令提示符
创建虚拟环境
conda create -n pytorch pip python=3.6
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: done
##Package Plan##
environment location: D:\Users\ThinkStation\anaconda3\envs\pytorch
added / updated specs:
- pip
- python=3.6
The following packages will be downloaded:
package | build
---------------------------|-----------------
certifi-2021.5.30 | py36haa95532_0 140 KB
pip-21.2.2 | py36haa95532_0 1.9 MB
python-3.6.13 | h3758d61_0 14.6 MB
setuptools-58.0.4 | py36haa95532_0 776 KB
sqlite-3.40.0 | h2bbff1b_0 891 KB
wincertstore-0.2 | py36h7fe50ca_0 14 KB
------------------------------------------------------------
Total: 18.3 MB
The following NEW packages will be INSTALLED:
certifi pkgs/main/win-64::certifi-2021.5.30-py36haa95532_0 None
pip pkgs/main/win-64::pip-21.2.2-py36haa95532_0 None
python pkgs/main/win-64::python-3.6.13-h3758d61_0 None
setuptools pkgs/main/win-64::setuptools-58.0.4-py36haa95532_0 None
sqlite pkgs/main/win-64::sqlite-3.40.0-h2bbff1b_0 None
vc pkgs/main/win-64::vc-14.2-h21ff451_1 None
vs2015_runtime pkgs/main/win-64::vs2015_runtime-14.27.29016-h5e58377_2 None
wheel pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0 None
wincertstore pkgs/main/win-64::wincertstore-0.2-py36h7fe50ca_0 None
Proceed ([y]/n)?
y
conda activate pytorch
去 https://download.pytorch.org/whl/torch_stable.html 下载pytorch版本的包
我下载的是
将该文件复制粘贴至cmd文件夹下
pip install torch-1.0.0-cp36-cp36m-win_amd64.whl
Installing collected packages: torch
Successfully installed torch-1.0.0
(pytorch) C:\Users\ThinkStation>python
报错:
ImportError: numpy.core.multiarray failed to import
错误原因:numpy版本不够,更新numpy版本即可,这里使用清华源更新
pip3 install numpy --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple