Use conda, pip install, update, view and uninstall reinstall Pytorch command {\color{Red}use conda, pip install, update, view and uninstall reinstall Pytorch command}Use c o n d a , p i p to install , update , view and uninstall reinstall P y t or ch command _
Table of contents
- Use conda, pip install, update, view and uninstall reinstall Pytorch command {\color{Red}use conda, pip install, update, view and uninstall reinstall Pytorch command}Use c o n d a , p i p to install , update , view and uninstall reinstall P y t or ch command _
- 1. Small rhythm
- 2. Update Pytorch and torchvision
- 3. Uninstall Pytorch and reinstall
- 4. How to install the specified version of Pytorch
- 5. How to view the current pytorch version
- Six, start
1. Small rhythm
Recently, I reinstalled CUDA and PyTorch, which is a small thing in itself. Unfortunately, the power went out during the installation, which caused some uncontrollable problems in the installation. When I went to Google to search for PyTorch, there was a sudden power outage, and I couldn’t find any relevant results, so I just Can it be reinstalled? However, when you reinstall the PyTorch installation command, for example, here is the installation command of torch11.1 conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge and there is no response when typing in cmd. What should I do now? In fact, just update the installation packages of pytorch and torchvision.
2. Update Pytorch and torchvision
Mainly collect pip, conda update Pytorch and torchvision instructions, so that basically Pytorch and torchvision can be updated on ubuntu, CentOS, Mac
2.1 Update Pytorch and torchvision with Pip
# 列举pip当前可以更新的所有安装包
pip list --outdated --format=legacy
# 更新pytorch和torchvision安装包
pip install --upgrade pytorch torchvision
2.2 Update Pytorch and torchvision with conda
# 建议将其添加soumith为您的Anaconda(或Miniconda)的源服务器
conda config --add channels soumith
# 更新pytorch和torchvision安装包
conda update pytorch torchvision
3. Uninstall Pytorch and reinstall
If the above method cannot update pytorch, you can uninstall and reinstall pytorch. The uninstallation method is as follows:
3.1 Uninstall PyTorch with pip
pip uninstall torch
3.2 Uninstall PyTorch with conda
conda uninstall pytorch
conda uninstall libtorch
4. How to install the specified version of Pytorch
4.1 Install PyTorch version with conda
# 比如我们安装 v0.1.10
conda install pytorch=0.1.10 -c soumith
4.2 Install PyTorch version with pip
pip install pytorch==0.1.10
5. How to view the current pytorch version
If we want to know the current pytorch version, if it is windows, just type cmd first in the interaction bar, and use the following code to print out the current Pytorch version in the command window:
import torch
print(torch.__version__)
Well, even though I have said so much, after my anaconda, Pytorch, cuda, and Pycharm compilers are installed, they still cannot compile. The laboratory is on holiday, so go home first!
If there are friends who are still unclear, you can take a look at this: Pytorch v0.2 release
Six, start
August has begun, I hope I can be more fearless, without love, there is still life