https://pytorch.org/
https://blog.csdn.net/weixin_43737866/article/details/127784768
https://www.jianshu.com/p/4c7b9127cf83
https://blog.csdn.net/m0_56945481/article/details/126998629
第一次裝Anaconda3最新版,報Solving environment: failed with initial frozen solve. Retrying with flexible solve.
搞了這個命令
conda config --add channels conda-forge conda config --set channel_priority flexible
之後,更新conda,完了之後報錯ImportError: DLL load failed while importing _ctypes: 找不到指定的模塊。
1.於是重裝Anaconda3-5.3.1-Windows-x86_64
(base) C:\Users\yhexie>conda info
CustomValidationError: Parameter channel_priority = 'flexible' declared in C:\Users\yhexie\.condarc is invalid.
The value 'flexible' cannot be boolified.
2.刪除C:\Users\yhexie\.condarc,重新啓動。
https://blog.csdn.net/xu96944967/article/details/127595899
3.conda安裝的居然沒有cuda支持,然後換一個虛擬環境繼續裝
pip install torch==1.10.1+cu102 torchvision==0.11.2+cu102 torchaudio==0.10.1 --extra-index-url https://download.pytorch.org/whl/cu102
這個命令跑了2遍,成功了。
檢查:
import torch
print(torch.__version__) #查看pytorch版本
print(torch.cuda.is_available()) #查看cuda是否可用 輸出爲True 或者False
(利用conda命令總是不成功,也可以嘗試使用pip命令進行安裝,這時就需要將鏡像源改成pip的鏡像源;同時如果conda命令和pip命令都不行,也可以利用先下載whl文件,然後pip直接安裝的方法。)