ModuleNotFoundError: No module named 'torch' PS G:\NJFU\YOLO\yolov5-corrosion> conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cpuonly Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Collecting package metadata (repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. PackagesNotFoundError: The following packages are not available from current channels: - cpuonly - pytorch==1.8.0 - torchvision==0.9.0 - torchaudio==0.8.0
时间: 2024-04-09 08:33:01 浏览: 196
It seems that you are encountering some issues with installing the required packages for PyTorch. The error message suggests that the packages you are trying to install are not available from the current channels.
To resolve this issue, you can try the following steps:
1. Create a new conda environment:
```bash
conda create -n myenv python=3.8
```
2. Activate the new environment:
```bash
conda activate myenv
```
3. Install PyTorch and torchvision using conda:
```bash
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cpuonly -c pytorch
```
By specifying the `-c pytorch` flag, conda will search for the packages in the PyTorch channel.
Please note that the `cpuonly` variant installs PyTorch without CUDA support, which means it will not utilize GPU acceleration. If you have a compatible GPU and want to enable GPU acceleration, you should install the appropriate version of PyTorch with CUDA support.
I hope this helps! Let me know if you have any further questions.
阅读全文