今天心血来潮,想在Debian上安装autosub
,项目地址:https://github.com/agermanidis/autosub
这是一个自动语音转文字的软件,基于python编写,以后有机会再介绍用法。
安装
autosub
:
shell
pip install autosub
在安装过程中遇到问题,报错:
shell
ERROR: Package 'cachetools' requires a different Python: 2.7.13 not in '~= 3.5'
意思是python版本应该是3.5左右而非2.7.13
这里我疑惑了很久,是因为我英语太差,把它错误理解成了需要2.7.13而不是3.5
踩坑过程,请勿轻易模仿
输入
pip -V
查看当前的python版本,得到:
shell
pip 20.0.2 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
可见python版本确实过低。我确定已经安装了python3.5,默认路径在/usr/bin/
,请首先确保你已经安装了新版的python
为新版python配置pip:
编辑文件/usr/location/bin/pip
,第一行改为#!/usr/bin/python3
如果该版本python未安装pip,执行:
shell
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
再运行autosub安装命令果然没有报错了
但是!经判断,autosub是基于python2的项目,在python3.5下无法运行!
如果你也不幸踩到这个坑,先把已经安装的autosub卸载
正确解法
问题出现的原因是cachetools
包更新至4.0.0
,此版本不支持2.7。我们只需手动安装低版本的cachetools
包
查看
cachetools
包历史版本
shell
pip install cachetools==?
出现信息:
shell
Looking in indexes: https://mirrors.aliyun.com/pypi/simple
ERROR: Could not find a version that satisfies the requirement cachetools==? (from versions: 0.0.0, 0.1.0, 0.2.0, 0.3.0, 0.3.1, 0.4.0, 0.5.0, 0.5.1, 0.6.0, 0.7.0, 0.7.1, 0.8.0, 0.8.1, 0.8.2, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.1.6, 2.0.0, 2.0.1, 2.1.0, 3.0.0, 3.1.0, 3.1.1, 4.0.0)
ERROR: No matching distribution found for cachetools==?
尝试安装
3.1.1
shell
pip install cachetools==3.1.1
安装成功后,再运行安装autosub
命令,程序成功安装并正常运行!
更新
受大佬@BingLingGroup指点,得知最新版的autosub支持python3,由于pip源更新慢于作者仓库,所以直接从github获取
运行以下命令执行安装即可
shell
pip3 install git+https://github.com/agermanidis/autosub.git@master