分类 python 下的文章

"Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work"

解决方法如下:

一、安装ffmpeg(已经安装可跳过)
安装ffmpeg
GitHub文档:https://github.com/BtbN/FFmpeg-Builds/releases/

环境变量配置
下载完压缩包之后,进行解压,将ffmpeg文件夹里的bin文件夹的路径复制一下。

==打开控制面板----系统和安全----系统----高级系统设置----环境变量----在系统变量里面找到Path,选中,点击编辑----新建----将复制的内容进行粘贴----确认。==
这样就完成了环境变量的配置。
检查配置是否成功
打开cmd,输入ffmpeg -version

在conda环境创建时的yaml文件中,pip 下的 -e
git+https://github.com/huggingface/transformers.git@main#egg=transformers 命令表示从 Github 上获取 transformers 库的最新版本,并将其安装到当前环境中。具体含义如下:

-e:表示使用开发模式进行安装,将软件包安装为可编辑模式,以便在本地对其进行修改和调试。 git+https://github.com/huggingface/transformers.git@main:表示从 Github
上获取 transformers 库的最新版本,并且使用 Git 协议进行下载。
egg=transformers:表示将软件包命名为 "transformers",以便在安装时能够识别它,并确保其与其他软件包不发生冲突。 通过执行此命令,可以在当前环境中安装并使用最新版本的
transformers 库。

按照上面的说法,所以我们第一步是clone项目:

git clone https://github.com/huggingface/transformers.git

进入 transformers 文件夹,并执行以下命令来安装 transformers 库:

pip install -e .

这将使用 pip 命令以可编辑模式进行安装,以便在本地对其进行修改和调试。

最后,验证 transformers 库是否已成功安装。可以在 Python 解释器中执行以下代码:

import transformers

print(transformers.__version__)

如果输出 transformers 库的版本号,则表示安装成功。

安装python第三方库的时候会提示报错缺少依赖库,报错如下:

ERROR: Could not find a version that satisfies the requirement 模块名 (from automat) (from versions: none)
ERROR: No matching distribution found for 模块名

ERROR: Could not find a version that satisfies the requirement triton (from versions: none)
ERROR: No matching distribution found for triton
没有具体提示的时候在官网下载最新安装即可
官网网址:https://pypi.org/

错误提示:Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at0x0000025C04CCC1C0>, 'Connection to pypi.org timed out. (connect timeout=15)')
解决方法:
pip install 命令添加 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
也可以把这些包源设置成默认的,方法是修改pip.ini文件的配置
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com
其他可用的镜像
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/