Linux安装autosub踩坑“ERROR: Package 'cachetools' requires a different Python: 2.7.13 not in '~= 3.5'”


今天心血来潮,想在Debian上安装autosub,项目地址:https://github.com/agermanidis/autosub
这是一个自动语音转文字的软件,基于python编写,以后有机会再介绍用法。

安装autosub

pip install autosub

在安装过程中遇到问题,报错:

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版本,得到:

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,执行:

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包历史版本

pip install cachetools==?

出现信息:

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

pip install cachetools==3.1.1

安装成功后,再运行安装autosub命令,程序成功安装并正常运行!


更新

受大佬@BingLingGroup指点,得知最新版的autosub支持python3,由于pip源更新慢于作者仓库,所以直接从github获取

运行以下命令执行安装即可

pip3 install git+https://github.com/agermanidis/autosub.git@master

问题最新进展 https://github.com/agermanidis/autosub/issues/171


文章作者: BoyInTheSun
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 BoyInTheSun !
 上一篇
Scrapy实例————爬取链家新房数据 Scrapy实例————爬取链家新房数据
目标通过Scrapy爬取链家新房数据,地址 https://bj.fang.lianjia.com/loupan ,并将爬取到的数据存储到json文件中。 环境博主是在Windows平台使用PyCharm基于Python 3.7和Scrap
2020-03-24
下一篇 
基于C语言用递归算法实现汉诺塔解法的计算 基于C语言用递归算法实现汉诺塔解法的计算
基于C语言用递归算法实现汉诺塔解法的计算如有不懂欢迎提问 /*************************************************************** 三根柱A(用0表示),B(用1表示),C(用2表示)
2020-03-17
  目录