关于安装基于Anaconda的Pytorch报错问题(文章为所有安装步骤)

由于一开始Pycharm无法下载资源包,所以打算重新安装一下Anaconda,没想到想在官网下载Anaconda时文件丢失,缺少Sprits文件,在网上尝试了很多方法也没有成功,最后猜测应该是之前卸载Anaconda时没有卸载干净,导致Sprits文件还是有残留,所以没有读取到,最后通过重装系统解决的。(C盘容量太小了,预留的空间不够,不建议尝试重装系统,太麻烦了)

进入正题

一 下载Anaconda

建议观看下面的链接,里面有很详细的安装过程。

(37条消息) 超详细Anaconda安装教程_极小白的博客-CSDN博客icon-default.png?t=N176https://blog.csdn.net/qq_45344586/article/details/124028689?ops_request_misc=&request_id=&biz_id=102&utm_term=anonconda%E4%B8%8B%E8%BD%BD%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-0-124028689.142^v73^wechat,201^v4^add_ask,239^v2^insert_chatgpt&spm=1018.2226.3001.4187

在下载Anaconda的时候一切都很顺利,最后可以在cmd命令行成功读取:

代码:conda list

C:\Users\40695>conda list
# packages in environment at D:\Anaconda\ANACONDA:
#
# Name                    Version                   Build  Channel
_ipyw_jlab_nb_ext_conf    0.1.0            py39haa95532_0
alabaster                 0.7.12             pyhd3eb1b0_0
anaconda                  2022.10                  py39_0
anaconda-client           1.11.0           py39haa95532_0
anaconda-navigator        2.3.1            py39haa95532_0
anaconda-project          0.11.1           py39haa95532_0
anyio                     3.5.0            py39haa95532_0
appdirs                   1.4.4              pyhd3eb1b0_0
argon2-cffi               21.3.0             pyhd3eb1b0_0
argon2-cffi-bindings      21.2.0           py39h2bbff1b_0
arrow                     1.2.2              pyhd3eb1b0_0
astroid                   2.11.7           py39haa95532_0
astropy                   5.1              py39h080aedc_0
atomicwrites              1.4.0                      py_0
attrs                     21.4.0             pyhd3eb1b0_0
automat                   20.2.0                     py_0
autopep8                  1.6.0              pyhd3eb1b0_1
babel                     2.9.1              pyhd3eb1b0_0
backcall                  0.2.0              pyhd3eb1b0_0
backports                 1.1                pyhd3eb1b0_0
backports.functools_lru_cache 1.6.4              pyhd3eb1b0_0
backports.tempfile        1.0                pyhd3eb1b0_1
backports.weakref         1.0.post1                  py_1
bcrypt                    3.2.0            py39h2bbff1b_1
beautifulsoup4            4.11.1           py39haa95532_0
binaryornot               0.4.4              pyhd3eb1b0_1
bitarray                  2.5.1            py39h2bbff1b_0
bkcharts                  0.2              py39haa95532_1
black                     22.6.0           py39haa95532_0
blas                      1.0                         mkl
bleach                    4.1.0              pyhd3eb1b0_0
blosc                     1.21.0               h19a0ad4_1
bokeh                     2.4.3            py39haa95532_0
boto3                     1.24.28          py39haa95532_0
botocore                  1.27.28          py39haa95532_0
bottleneck                1.3.5            py39h080aedc_0
brotli                    1.0.9                h2bbff1b_7
brotli-bin                1.0.9                h2bbff1b_7
brotlipy                  0.7.0           py39h2bbff1b_1003
bzip2                     1.0.8                he774522_0
ca-certificates           2022.07.19           haa95532_0
certifi                   2022.9.14        py39haa95532_0
cffi                      1.15.1           py39h2bbff1b_0
cfitsio                   3.470                h2bbff1b_7
chardet                   4.0.0           py39haa95532_1003
charls                    2.2.0                h6c2663c_0
charset-normalizer        2.0.4              pyhd3eb1b0_0
click                     8.0.4            py39haa95532_0
cloudpickle               2.0.0              pyhd3eb1b0_0
clyent                    1.2.2            py39haa95532_1
colorama                  0.4.5            py39haa95532_0
colorcet                  3.0.0            py39haa95532_0
comtypes                  1.1.10          py39haa95532_1002
conda                     22.9.0           py39haa95532_0
conda-build               3.22.0           py39haa95532_0
conda-content-trust       0.1.3            py39haa95532_0
conda-env                 2.6.0                haa95532_1
conda-pack                0.6.0              pyhd3eb1b0_0
conda-package-handling    1.9.0            py39h8cc25b3_0
conda-repo-cli            1.0.20           py39haa95532_0
conda-token               0.4.0              pyhd3eb1b0_0
conda-verify              3.4.2                      py_1
console_shortcut          0.1.1                         4
constantly                15.1.0             pyh2b92418_0
cookiecutter              1.7.3              pyhd3eb1b0_0
cryptography              37.0.1           py39h21b164f_0
cssselect                 1.1.0              pyhd3eb1b0_0
curl                      7.84.0               h2bbff1b_0
cycler                    0.11.0             pyhd3eb1b0_0
cython                    0.29.32          py39hd77b12b_0
cytoolz                   0.11.0           py39h2bbff1b_0
daal4py                   2021.6.0         py39h757b272_1
dal                       2021.6.0           h59b6b97_874
dask                      2022.7.0         py39haa95532_0
dask-core                 2022.7.0         py39haa95532_0
dataclasses               0.8                pyh6d0b6a4_7
datashader                0.14.1           py39haa95532_0
datashape                 0.5.4            py39haa95532_1
debugpy                   1.5.1            py39hd77b12b_0
decorator                 5.1.1              pyhd3eb1b0_0
defusedxml                0.7.1              pyhd3eb1b0_0
diff-match-patch          20200713           pyhd3eb1b0_0
dill                      0.3.4              pyhd3eb1b0_0
distributed               2022.7.0         py39haa95532_0
docutils                  0.18.1           py39haa95532_3
entrypoints               0.4              py39haa95532_0
et_xmlfile                1.1.0            py39haa95532_0
fftw                      3.3.9                h2bbff1b_1
filelock                  3.6.0              pyhd3eb1b0_0
flake8                    4.0.1              pyhd3eb1b0_1
flask                     1.1.2              pyhd3eb1b0_0
fonttools                 4.25.0             pyhd3eb1b0_0
freetype                  2.10.4               hd328e21_0
fsspec                    2022.7.1         py39haa95532_0
future                    0.18.2           py39haa95532_1
gensim                    4.1.2            py39hd77b12b_0
giflib                    5.2.1                h62dcd97_0
glob2                     0.7                pyhd3eb1b0_0
greenlet                  1.1.1            py39hd77b12b_0
h5py                      3.7.0            py39h3de5c98_0
hdf5                      1.10.6               h1756f20_1
heapdict                  1.0.1              pyhd3eb1b0_0
holoviews                 1.15.0           py39haa95532_0
hvplot                    0.8.0            py39haa95532_0
hyperlink                 21.0.0             pyhd3eb1b0_0
icc_rt                    2022.1.0             h6049295_2
icu                       58.2                 ha925a31_3
idna                      3.3                pyhd3eb1b0_0
imagecodecs               2021.8.26        py39hc0a7faf_1
imageio                   2.19.3           py39haa95532_0
imagesize                 1.4.1            py39haa95532_0
importlib-metadata        4.11.3           py39haa95532_0
importlib_metadata        4.11.3               hd3eb1b0_0
incremental               21.3.0             pyhd3eb1b0_0
inflection                0.5.1            py39haa95532_0
iniconfig                 1.1.1              pyhd3eb1b0_0
intake                    0.6.5              pyhd3eb1b0_0
intel-openmp              2021.4.0          haa95532_3556
intervaltree              3.1.0              pyhd3eb1b0_0
ipykernel                 6.15.2           py39haa95532_0
ipython                   7.31.1           py39haa95532_1
ipython_genutils          0.2.0              pyhd3eb1b0_1
ipywidgets                7.6.5              pyhd3eb1b0_1
isort                     5.9.3              pyhd3eb1b0_0
itemadapter               0.3.0              pyhd3eb1b0_0
itemloaders               1.0.4              pyhd3eb1b0_1
itsdangerous              2.0.1              pyhd3eb1b0_0
jdcal                     1.4.1              pyhd3eb1b0_0
jedi                      0.18.1           py39haa95532_1
jellyfish                 0.9.0            py39h2bbff1b_0
jinja2                    2.11.3             pyhd3eb1b0_0
jinja2-time               0.2.0              pyhd3eb1b0_3
jmespath                  0.10.0             pyhd3eb1b0_0
joblib                    1.1.0              pyhd3eb1b0_0
jpeg                      9e                   h2bbff1b_0
jq                        1.6                  haa95532_1
json5                     0.9.6              pyhd3eb1b0_0
jsonschema                4.16.0           py39haa95532_0
jupyter                   1.0.0            py39haa95532_8
jupyter_client            7.3.4            py39haa95532_0
jupyter_console           6.4.3              pyhd3eb1b0_0
jupyter_core              4.11.1           py39haa95532_0
jupyter_server            1.18.1           py39haa95532_0
jupyterlab                3.4.4            py39haa95532_0
jupyterlab_pygments       0.1.2                      py_0
jupyterlab_server         2.10.3             pyhd3eb1b0_1
jupyterlab_widgets        1.0.0              pyhd3eb1b0_1
keyring                   23.4.0           py39haa95532_0
kiwisolver                1.4.2            py39hd77b12b_0
lazy-object-proxy         1.6.0            py39h2bbff1b_0
lcms2                     2.12                 h83e58a3_0
lerc                      3.0                  hd77b12b_0
libaec                    1.0.4                h33f27b4_1
libarchive                3.6.1                hebabd0d_0
libbrotlicommon           1.0.9                h2bbff1b_7
libbrotlidec              1.0.9                h2bbff1b_7
libbrotlienc              1.0.9                h2bbff1b_7
libcurl                   7.84.0               h86230a5_0
libdeflate                1.8                  h2bbff1b_5
libiconv                  1.16                 h2bbff1b_2
liblief                   0.11.5               hd77b12b_1
libpng                    1.6.37               h2a8f88b_0
libsodium                 1.0.18               h62dcd97_0
libspatialindex           1.9.3                h6c2663c_0
libssh2                   1.10.0               hcd4344a_0
libtiff                   4.4.0                h8a3f274_0
libwebp                   1.2.2                h2bbff1b_0
libxml2                   2.9.14               h0ad7f3c_0
libxslt                   1.1.35               h2bbff1b_0
libzopfli                 1.0.3                ha925a31_0
llvmlite                  0.38.0           py39h23ce68f_0
locket                    1.0.0            py39haa95532_0
lxml                      4.9.1            py39h1985fb9_0
lz4                       3.1.3            py39h2bbff1b_0
lz4-c                     1.9.3                h2bbff1b_1
lzo                       2.10                 he774522_2
m2-msys2-runtime          2.5.0.17080.65c939c               3
m2-patch                  2.7.5                         2
m2w64-libwinpthread-git   5.0.0.4634.697f757               2
markdown                  3.3.4            py39haa95532_0
markupsafe                2.0.1            py39h2bbff1b_0
matplotlib                3.5.2            py39haa95532_0
matplotlib-base           3.5.2            py39hd77b12b_0
matplotlib-inline         0.1.6            py39haa95532_0
mccabe                    0.6.1            py39haa95532_2
menuinst                  1.4.19           py39h59b6b97_0
mistune                   0.8.4           py39h2bbff1b_1000
mkl                       2021.4.0           haa95532_640
mkl-service               2.4.0            py39h2bbff1b_0
mkl_fft                   1.3.1            py39h277e83a_0
mkl_random                1.2.2            py39hf11a4ad_0
mock                      4.0.3              pyhd3eb1b0_0
mpmath                    1.2.1            py39haa95532_0
msgpack-python            1.0.3            py39h59b6b97_0
msys2-conda-epoch         20160418                      1
multipledispatch          0.6.0            py39haa95532_0
munkres                   1.1.4                      py_0
mypy_extensions           0.4.3            py39haa95532_1
navigator-updater         0.3.0            py39haa95532_0
nbclassic                 0.3.5              pyhd3eb1b0_0
nbclient                  0.5.13           py39haa95532_0
nbconvert                 6.4.4            py39haa95532_0
nbformat                  5.5.0            py39haa95532_0
nest-asyncio              1.5.5            py39haa95532_0
networkx                  2.8.4            py39haa95532_0
nltk                      3.7                pyhd3eb1b0_0
nose                      1.3.7           pyhd3eb1b0_1008
notebook                  6.4.12           py39haa95532_0
numba                     0.55.1           py39hf11a4ad_0
numexpr                   2.8.3            py39hb80d3ca_0
numpy                     1.21.5           py39h7a0a035_3
numpy-base                1.21.5           py39hca35cd5_3
numpydoc                  1.4.0            py39haa95532_0
olefile                   0.46               pyhd3eb1b0_0
openjpeg                  2.4.0                h4fc8c34_0
openpyxl                  3.0.10           py39h2bbff1b_0
openssl                   1.1.1q               h2bbff1b_0
packaging                 21.3               pyhd3eb1b0_0
pandas                    1.4.4            py39hd77b12b_0
pandocfilters             1.5.0              pyhd3eb1b0_0
panel                     0.13.1           py39haa95532_0
param                     1.12.0             pyhd3eb1b0_0
paramiko                  2.8.1              pyhd3eb1b0_0
parsel                    1.6.0            py39haa95532_0
parso                     0.8.3              pyhd3eb1b0_0
partd                     1.2.0              pyhd3eb1b0_1
pathlib                   1.0.1              pyhd3eb1b0_1
pathspec                  0.9.0            py39haa95532_0
patsy                     0.5.2            py39haa95532_1
pep8                      1.7.1            py39haa95532_1
pexpect                   4.8.0              pyhd3eb1b0_3
pickleshare               0.7.5           pyhd3eb1b0_1003
pillow                    9.2.0            py39hdc2b20a_1
pip                       22.2.2           py39haa95532_0
pkginfo                   1.8.2              pyhd3eb1b0_0
platformdirs              2.5.2            py39haa95532_0
plotly                    5.9.0            py39haa95532_0
pluggy                    1.0.0            py39haa95532_1
powershell_shortcut       0.0.1                         3
poyo                      0.5.0              pyhd3eb1b0_0
prometheus_client         0.14.1           py39haa95532_0
prompt-toolkit            3.0.20             pyhd3eb1b0_0
prompt_toolkit            3.0.20               hd3eb1b0_0
protego                   0.1.16                     py_0
psutil                    5.9.0            py39h2bbff1b_0
ptyprocess                0.7.0              pyhd3eb1b0_2
py                        1.11.0             pyhd3eb1b0_0
py-lief                   0.11.5           py39hd77b12b_1
pyasn1                    0.4.8              pyhd3eb1b0_0
pyasn1-modules            0.2.8                      py_0
pycodestyle               2.8.0              pyhd3eb1b0_0
pycosat                   0.6.3            py39h2bbff1b_0
pycparser                 2.21               pyhd3eb1b0_0
pyct                      0.4.8            py39haa95532_1
pycurl                    7.45.1           py39hcd4344a_0
pydispatcher              2.0.5            py39haa95532_2
pydocstyle                6.1.1              pyhd3eb1b0_0
pyerfa                    2.0.0            py39h2bbff1b_0
pyflakes                  2.4.0              pyhd3eb1b0_0
pygments                  2.11.2             pyhd3eb1b0_0
pyhamcrest                2.0.2              pyhd3eb1b0_2
pyjwt                     2.4.0            py39haa95532_0
pylint                    2.14.5           py39haa95532_0
pyls-spyder               0.4.0              pyhd3eb1b0_0
pynacl                    1.5.0            py39h8cc25b3_0
pyodbc                    4.0.34           py39hd77b12b_0
pyopenssl                 22.0.0             pyhd3eb1b0_0
pyparsing                 3.0.9            py39haa95532_0
pyqt                      5.9.2            py39hd77b12b_6
pyrsistent                0.18.0           py39h196d8e1_0
pysocks                   1.7.1            py39haa95532_0
pytables                  3.6.1            py39h56d22b6_1
pytest                    7.1.2            py39haa95532_0
python                    3.9.13               h6244533_1
python-dateutil           2.8.2              pyhd3eb1b0_0
python-fastjsonschema     2.16.2           py39haa95532_0
python-libarchive-c       2.9                pyhd3eb1b0_1
python-lsp-black          1.0.0              pyhd3eb1b0_0
python-lsp-jsonrpc        1.0.0              pyhd3eb1b0_0
python-lsp-server         1.3.3              pyhd3eb1b0_0
python-slugify            5.0.2              pyhd3eb1b0_0
python-snappy             0.6.0            py39hd77b12b_3
pytz                      2022.1           py39haa95532_0
pyviz_comms               2.0.2              pyhd3eb1b0_0
pywavelets                1.3.0            py39h2bbff1b_0
pywin32                   302              py39h2bbff1b_2
pywin32-ctypes            0.2.0           py39haa95532_1000
pywinpty                  2.0.2            py39h5da7b33_0
pyyaml                    6.0              py39h2bbff1b_1
pyzmq                     23.2.0           py39hd77b12b_0
qdarkstyle                3.0.2              pyhd3eb1b0_0
qstylizer                 0.1.10             pyhd3eb1b0_0
qt                        5.9.7            vc14h73c81de_0
qtawesome                 1.0.3              pyhd3eb1b0_0
qtconsole                 5.2.2              pyhd3eb1b0_0
qtpy                      2.2.0            py39haa95532_0
queuelib                  1.5.0            py39haa95532_0
regex                     2022.7.9         py39h2bbff1b_0
requests                  2.28.1           py39haa95532_0
requests-file             1.5.1              pyhd3eb1b0_0
rope                      0.22.0             pyhd3eb1b0_0
rtree                     0.9.7            py39h2eaa2aa_1
ruamel_yaml               0.15.100         py39h2bbff1b_0
s3transfer                0.6.0            py39haa95532_0
scikit-image              0.19.2           py39hf11a4ad_0
scikit-learn              1.0.2            py39hf11a4ad_1
scikit-learn-intelex      2021.6.0         py39haa95532_0
scipy                     1.9.1            py39he11b74f_0
scrapy                    2.6.2            py39haa95532_0
seaborn                   0.11.2             pyhd3eb1b0_0
send2trash                1.8.0              pyhd3eb1b0_1
service_identity          18.1.0             pyhd3eb1b0_1
setuptools                63.4.1           py39haa95532_0
sip                       4.19.13          py39hd77b12b_0
six                       1.16.0             pyhd3eb1b0_1
smart_open                5.2.1            py39haa95532_0
snappy                    1.1.9                h6c2663c_0
sniffio                   1.2.0            py39haa95532_1
snowballstemmer           2.2.0              pyhd3eb1b0_0
sortedcollections         2.1.0              pyhd3eb1b0_0
sortedcontainers          2.4.0              pyhd3eb1b0_0
soupsieve                 2.3.1              pyhd3eb1b0_0
sphinx                    5.0.2            py39haa95532_0
sphinxcontrib-applehelp   1.0.2              pyhd3eb1b0_0
sphinxcontrib-devhelp     1.0.2              pyhd3eb1b0_0
sphinxcontrib-htmlhelp    2.0.0              pyhd3eb1b0_0
sphinxcontrib-jsmath      1.0.1              pyhd3eb1b0_0
sphinxcontrib-qthelp      1.0.3              pyhd3eb1b0_0
sphinxcontrib-serializinghtml 1.1.5              pyhd3eb1b0_0
spyder                    5.2.2            py39haa95532_1
spyder-kernels            2.2.1            py39haa95532_0
sqlalchemy                1.4.39           py39h2bbff1b_0
sqlite                    3.39.3               h2bbff1b_0
statsmodels               0.13.2           py39h2bbff1b_0
sympy                     1.10.1           py39haa95532_0
tabulate                  0.8.10           py39haa95532_0
tbb                       2021.6.0             h59b6b97_0
tbb4py                    2021.6.0         py39h59b6b97_0
tblib                     1.7.0              pyhd3eb1b0_0
tenacity                  8.0.1            py39haa95532_1
terminado                 0.13.1           py39haa95532_0
testpath                  0.6.0            py39haa95532_0
text-unidecode            1.3                pyhd3eb1b0_0
textdistance              4.2.1              pyhd3eb1b0_0
threadpoolctl             2.2.0              pyh0d69192_0
three-merge               0.1.1              pyhd3eb1b0_0
tifffile                  2021.7.2           pyhd3eb1b0_2
tinycss                   0.4             pyhd3eb1b0_1002
tk                        8.6.12               h2bbff1b_0
tldextract                3.2.0              pyhd3eb1b0_0
toml                      0.10.2             pyhd3eb1b0_0
tomli                     2.0.1            py39haa95532_0
tomlkit                   0.11.1           py39haa95532_0
toolz                     0.11.2             pyhd3eb1b0_0
tornado                   6.1              py39h2bbff1b_0
tqdm                      4.64.1           py39haa95532_0
traitlets                 5.1.1              pyhd3eb1b0_0
twisted                   22.2.0           py39h2bbff1b_1
twisted-iocpsupport       1.0.2            py39h2bbff1b_0
typing-extensions         4.3.0            py39haa95532_0
typing_extensions         4.3.0            py39haa95532_0
tzdata                    2022c                h04d1e81_0
ujson                     5.4.0            py39hd77b12b_0
unidecode                 1.2.0              pyhd3eb1b0_0
urllib3                   1.26.11          py39haa95532_0
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
w3lib                     1.21.0             pyhd3eb1b0_0
watchdog                  2.1.6            py39haa95532_0
wcwidth                   0.2.5              pyhd3eb1b0_0
webencodings              0.5.1            py39haa95532_1
websocket-client          0.58.0           py39haa95532_4
werkzeug                  2.0.3              pyhd3eb1b0_0
wheel                     0.37.1             pyhd3eb1b0_0
widgetsnbextension        3.5.2            py39haa95532_0
win_inet_pton             1.1.0            py39haa95532_0
win_unicode_console       0.5              py39haa95532_0
wincertstore              0.2              py39haa95532_2
winpty                    0.4.3                         4
wrapt                     1.14.1           py39h2bbff1b_0
xarray                    0.20.1             pyhd3eb1b0_1
xlrd                      2.0.1              pyhd3eb1b0_0
xlsxwriter                3.0.3              pyhd3eb1b0_0
xlwings                   0.27.15          py39haa95532_0
xz                        5.2.6                h8cc25b3_0
yaml                      0.2.5                he774522_0
yapf                      0.31.0             pyhd3eb1b0_0
zeromq                    4.3.4                hd77b12b_0
zfp                       0.5.5                hd77b12b_6
zict                      2.1.0            py39haa95532_0
zipp                      3.8.0            py39haa95532_0
zlib                      1.2.12               h8cc25b3_3
zope                      1.0              py39haa95532_1
zope.interface            5.4.0            py39h2bbff1b_0
zstd                      1.5.2                h19a0ad4_0

其次是安装Cuda,我的显卡版本是NVIDA 3060,搭配的是cuda12.0版本,具体的版本在Nvida控制面板可以自行查看。

1.打开Nvida控制面板,选择左下角的系统信息。

关于安装基于Anaconda的Pytorch报错问题(文章为所有安装步骤)_第1张图片

 2.在系统信息中选择组件

关于安装基于Anaconda的Pytorch报错问题(文章为所有安装步骤)_第2张图片

里面会显示NVIDA所能支持的最高的CUDA版本。 

3.安装

进入cuda官网选择对应的软件包进行下载即可,下载后用cmd命令行查看是否安装:

代码:nvcc -V

C:\Users\40695>nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Fri_Jan__6_19:04:39_Pacific_Standard_Time_2023
Cuda compilation tools, release 12.0, V12.0.140
Build cuda_12.0.r12.0/compiler.32267302_0

三 安装Pytorch

这一步是我卡的最久的步骤了,在之前的安装过程中没有任何问题。(原操作系统是win10,然后后升级的win11,升级后也可以运行)

首先进入Pytorch官网

关于安装基于Anaconda的Pytorch报错问题(文章为所有安装步骤)_第3张图片

 首先根据自己的电脑环境来选择相应的版本,由于我用的是Python还有Conda的Package,大家可以通过自己的需要选择,CUDA版本根据自己需要选择。(注意:CPU版本只可以用CPU进行编译运行,无法用CUDA调用GPU来编译运行,如果想用GPU编程,所以一定要选择CUDA版本)

第二步:将红框中的链接复制,用管理员运行cmd命令行:

关于安装基于Anaconda的Pytorch报错问题(文章为所有安装步骤)_第4张图片

这是正常运行的情况,输入y进行安装即可。

还有一种情况

 关于安装基于Anaconda的Pytorch报错问题(文章为所有安装步骤)_第5张图片

 cmd管理员运行会出现CondaSSLError报错:

OpenSSL appears to be unavailable on this machine. OpenSSL is required to
download and install packages.

这个错误意思是OpenSSL出了问题,我在这里卡了很久没办法进行安装,直到今天突发奇想,运行了CONDA:

关于安装基于Anaconda的Pytorch报错问题(文章为所有安装步骤)_第6张图片

 选择Anaconda命令行,以管理员身份运行。

再将从Pytorch复制的代码粘贴

(base) C:\Windows\System32>conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
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:\Anaconda\ANACONDA

  added / updated specs:
    - pytorch
    - pytorch-cuda=11.7
    - torchaudio
    - torchvision


The following NEW packages will be INSTALLED:

  cuda               nvidia/win-64::cuda-11.7.1-0 None
  cuda-cccl          nvidia/win-64::cuda-cccl-11.7.91-0 None
  cuda-command-line~ nvidia/win-64::cuda-command-line-tools-11.7.1-0 None
  cuda-compiler      nvidia/win-64::cuda-compiler-11.7.1-0 None
  cuda-cudart        nvidia/win-64::cuda-cudart-11.7.99-0 None
  cuda-cudart-dev    nvidia/win-64::cuda-cudart-dev-11.7.99-0 None
  cuda-cuobjdump     nvidia/win-64::cuda-cuobjdump-11.7.91-0 None
  cuda-cupti         nvidia/win-64::cuda-cupti-11.7.101-0 None
  cuda-cuxxfilt      nvidia/win-64::cuda-cuxxfilt-11.7.91-0 None
  cuda-demo-suite    nvidia/win-64::cuda-demo-suite-12.0.140-0 None
  cuda-documentation nvidia/win-64::cuda-documentation-12.0.140-0 None
  cuda-libraries     nvidia/win-64::cuda-libraries-11.7.1-0 None
  cuda-libraries-dev nvidia/win-64::cuda-libraries-dev-11.7.1-0 None
  cuda-memcheck      nvidia/win-64::cuda-memcheck-11.8.86-0 None
  cuda-nsight-compu~ nvidia/win-64::cuda-nsight-compute-12.0.1-0 None
  cuda-nvcc          nvidia/win-64::cuda-nvcc-11.7.99-0 None
  cuda-nvdisasm      nvidia/win-64::cuda-nvdisasm-12.0.140-0 None
  cuda-nvml-dev      nvidia/win-64::cuda-nvml-dev-11.7.91-0 None
  cuda-nvprof        nvidia/win-64::cuda-nvprof-12.0.146-0 None
  cuda-nvprune       nvidia/win-64::cuda-nvprune-11.7.91-0 None
  cuda-nvrtc         nvidia/win-64::cuda-nvrtc-11.7.99-0 None
  cuda-nvrtc-dev     nvidia/win-64::cuda-nvrtc-dev-11.7.99-0 None
  cuda-nvtx          nvidia/win-64::cuda-nvtx-11.7.91-0 None
  cuda-nvvp          nvidia/win-64::cuda-nvvp-12.0.146-0 None
  cuda-runtime       nvidia/win-64::cuda-runtime-11.7.1-0 None
  cuda-sanitizer-api nvidia/win-64::cuda-sanitizer-api-12.0.140-0 None
  cuda-toolkit       nvidia/win-64::cuda-toolkit-11.7.1-0 None
  cuda-tools         nvidia/win-64::cuda-tools-11.7.1-0 None
  cuda-visual-tools  nvidia/win-64::cuda-visual-tools-11.7.1-0 None
  libcublas          nvidia/win-64::libcublas-11.10.3.66-0 None
  libcublas-dev      nvidia/win-64::libcublas-dev-11.10.3.66-0 None
  libcufft           nvidia/win-64::libcufft-10.7.2.124-0 None
  libcufft-dev       nvidia/win-64::libcufft-dev-10.7.2.124-0 None
  libcurand          nvidia/win-64::libcurand-10.3.1.124-0 None
  libcurand-dev      nvidia/win-64::libcurand-dev-10.3.1.124-0 None
  libcusolver        nvidia/win-64::libcusolver-11.4.0.1-0 None
  libcusolver-dev    nvidia/win-64::libcusolver-dev-11.4.0.1-0 None
  libcusparse        nvidia/win-64::libcusparse-11.7.4.91-0 None
  libcusparse-dev    nvidia/win-64::libcusparse-dev-11.7.4.91-0 None
  libnpp             nvidia/win-64::libnpp-11.7.4.75-0 None
  libnpp-dev         nvidia/win-64::libnpp-dev-11.7.4.75-0 None
  libnvjpeg          nvidia/win-64::libnvjpeg-11.8.0.2-0 None
  libnvjpeg-dev      nvidia/win-64::libnvjpeg-dev-11.8.0.2-0 None
  libuv              pkgs/main/win-64::libuv-1.40.0-he774522_0 None
  nsight-compute     nvidia/win-64::nsight-compute-2022.4.1.6-0 None
  pytorch            pytorch/win-64::pytorch-1.13.1-py3.9_cuda11.7_cudnn8_0 None
  pytorch-cuda       pytorch/noarch::pytorch-cuda-11.7-h67b0de4_1 None
  pytorch-mutex      pytorch/noarch::pytorch-mutex-1.0-cuda None
  ruamel.yaml        pkgs/main/win-64::ruamel.yaml-0.17.21-py39h2bbff1b_0 None
  ruamel.yaml.clib   pkgs/main/win-64::ruamel.yaml.clib-0.2.6-py39h2bbff1b_1 None
  torchaudio         pytorch/win-64::torchaudio-0.13.1-py39_cu117 None
  torchvision        pytorch/win-64::torchvision-0.14.1-py39_cu117 None

The following packages will be UPDATED:

  conda                               22.9.0-py39haa95532_0 --> 23.1.0-py39haa95532_0 None


Proceed ([y]/n)?

选择y即可安装。

安装Pycharm

首先进入Pycharm官网

关于安装基于Anaconda的Pytorch报错问题(文章为所有安装步骤)_第7张图片

 

在这里选择社区版(Community) .exe(不要选择ARM64,会不兼容),进行下载即可。

以上是博主自己安装实际经历,如果有更好的办法或者表述有错误希望大佬们及时指正!!!

你可能感兴趣的:(报错,pytorch,python,人工智能)