安装yolov5配套的库遇到的问题

本文讲述了在PyCharm终端中通过pipinstall命令安装项目时遇到的三个错误,包括找不到requirements.txt文件、无法卸载已安装的PyYAML以及依赖版本冲突。作者提供了逐步解决这些问题的方法,如切换目录、忽略特定库的安装和升级Spyder到兼容版本。
摘要由CSDN通过智能技术生成

        使用 pip install -U -r requirements.txt 在pycharm的终端进行安装。

        首先第一个报错:

ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
       出现这个报错的原因是当前目录下没有名为requirements.txt的文件,大概率是因为你没有进入存放该文件的上级目录。使用cd指令进入存放该文件的上级目录。以下是示例

cd PS C:\Users\你的PC用户名\Desktop\yolov5> cd C:\Users\你的PC用户名\Desktop\yolov5\yolov5-master

        执行完后pycharm终端就会从 C:\Users\Phoenix\Desktop\yolov5>

        切换为C:\Users\Phoenix\Desktop\yolov5\yolov5-master> 

        继续使用pip install -U -r requirements.txt 在pycharm的终端进行安装。

        第二个报错:

ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

        错误:无法卸载“PyYAML”。这是一个distutils安装的项目,因此我们无法准确确定哪些文件属于它,这只会导致部分卸载。

        在其他博客里找到的解决方法是:

pip install -U -r requirements.txt  --ignore-installed PyYAML

        加入  --ignore-installed PyYAML 忽略报错库的安装,但是在实际使用时却会遇到下一个报错。

        第三个报错:        

ERROR: Double requirement given: PyYAML>=5.3.1 (from -r requirements.txt (line 11)) (already in PyYAML, name='PyYAML')

        错误:给出了双重要求:PyYAML>=5.3.1(来自-r requirements.txt(第11行))(已在PyYAML中,名称=“PyYAML”)

        这里我找了好久也没找到解决办法,最后只好从报错入手,去查看了requirements.txt文件,将其中的

PyYAML>=5.3.1

        替换为(相当于忽略版本要求)

PyYAML

        重新执行 pip install -U -r requirements.txt   --ignore-installed PyYAML 但又会出现好多报错。

ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.


spyder 4.1.5 requires pyqt5<5.13; python_version >= "3", which is not installed.
spyder 4.1.5 requires pyqtwebengine<5.13; python_version >= "3", which is not installed.
torchaudio 2.2.1+cu118 requires torch==2.2.1+cu118, but you'll have torch 2.2.1 which is incompatible.

        我们一个个来解决,先从

spyder 4.1.5 requires pyqt5<5.13; python_version >= "3", which is not installed.
spyder 4.1.5 requires pyqtwebengine<5.13; python_version >= "3", which is not installed.

着手,原因是Spyder不是最新版本,而我的pyqtwebengine和pyqt5的版本是最新的,出现了不匹配的问题,需要安装新版本的Spyder。使用指令

pip install spyder==*

        可以查看所有版本的spyder

        我这里下载的是5.5.1版本

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ spyder==5.5.1

        类似的报错都可以通过如上的方式处理。

  • 13
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

钧尘

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值