我正在使用安装了 Python 3.8 的 Ubuntu 20.04。我正在按照教程来让 YOLOv5 运行(https://medium.com/quantrium-tech/working-with-yolov5-7623a41fbdf8) 用于研究项目。本教程建议设置虚拟环境来运行 YOLOv5。但是,当我尝试使用以下命令安装 Python 虚拟环境时:
$ sudo apt-get install python3.8-venv
我收到此错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
libcuinj64-10.1 : Depends: libcuda1 (>= 418.39) or
libnvidia-tesla-cuda1 (>= 418.39) but it is not installable or
libcuda.so.1 (>= 418.39) but it is not installable or
libcuda-10.1-1
libnvidia-ml-dev : Depends: libnvidia-ml1 (>= 418.39) or
libnvidia-tesla-440-ml1 (>= 418.39) but it is not installable or
libnvidia-tesla-418-ml1 (>= 418.39) but it is not installable or
libnvidia-ml.so.1 (>= 418.39) but it is not installable
python3.8-venv : Depends: python3.8 (= 3.8.10-0ubuntu1~20.04.4) but 3.8.10-0ubuntu1~20.04.1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
当我尝试推荐时:
$ apt --fix-broken install
我收到以下错误:
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
人们建议使用 aptitude 而不是 apt,当我尝试时:
$ sudo apt-get install aptitude
我收到以下错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
aptitude : Depends: aptitude-common (= 0.8.12-1ubuntu4) but it is not going to be installed
Depends: libcwidget4 (>= 0.5.18-1) but it is not going to be installed
Depends: libxapian30 (>= 1.4.14~) but it is not going to be installed
Recommends: libparse-debianchangelog-perl but it is not going to be installed
libcuinj64-10.1 : Depends: libcuda1 (>= 418.39) or
libnvidia-tesla-cuda1 (>= 418.39) but it is not installable or
libcuda.so.1 (>= 418.39) but it is not installable or
libcuda-10.1-1
libnvidia-ml-dev : Depends: libnvidia-ml1 (>= 418.39) or
libnvidia-tesla-440-ml1 (>= 418.39) but it is not installable or
libnvidia-tesla-418-ml1 (>= 418.39) but it is not installable or
libnvidia-ml.so.1 (>= 418.39) but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
基本上,我甚至无法安装 aptitude,因为同样的依赖性问题阻碍了我的虚拟环境。我还运行了:
sudo apt upgrade
sudo apt update
并尝试使用以下命令直接安装缺少的软件包:
sudo apt-get install libcuinj64-10.1
sudo apt-get install libnvidia-ml-dev
我尝试使用以下命令清除 cuda 和 nvidia:
sudo apt-get --purge remove "*cublas*" "cuda*" "nsight*"
sudo apt-get --purge remove "*nvidia*"
当这不起作用时我还尝试了:
sudo apt-get purge nvidia*
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /usr/local/cuda*
到目前为止,StackExchange 或 StackOverflow 上没有任何方法可行,我迫切希望它能正常工作。如果有人能帮助我,我将不胜感激。