我正在尝试使用python深度学习模块keras-audio来训练音频文件(python 3.8.6,MacOS 10.14.6)。但是,在安装该模块并尝试运行示例后,我得到了以下错误
Traceback (most recent call last):
File "demo/cifar10_train.py", line 1, in <module>
from keras_audio.library.cifar10 import Cifar10AudioClassifier
File "/Users/user/keras-audio/keras-audio/keras_audio/library/cifar10.py", line 2, in <module>
from lru import LRU
ModuleNotFoundError: No module named 'lru'
因此,我尝试使用以下命令安装该软件包
pip install lru
这产生了以下错误:
Collecting lru
Using cached lru-0.1.tar.gz (1.1 kB)
ERROR: Command errored out with exit status 1:
command: /Users/users/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/0g/wwq2q6nn35n8vmrwhw5qfk601zlkw_/T/pip-install-tohqsyc0/lru_e04682eaa31f4d3291305bac811979b4/setup.py'"'"'; __file__='"'"'/private/var/folders/0g/wwq2q6nn35n8vmrwhw5qfk601zlkw_/T/pip-install-tohqsyc0/lru_e04682eaa31f4d3291305bac811979b4/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/0g/wwq2q6nn35n8vmrwhw5qfk601zlkw_/T/pip-pip-egg-info-kv5i7tfq
cwd: /private/var/folders/0g/wwq2q6nn35n8vmrwhw5qfk601zlkw_/T/pip-install-tohqsyc0/lru_e04682eaa31f4d3291305bac811979b4/
Complete output (8 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/0g/wwq2q6nn35n8vmrwhw5qfk601zlkw_/T/pip-install-tohqsyc0/lru_e04682eaa31f4d3291305bac811979b4/setup.py", line 2, in <module>
from lru import __version__ as version
File "/private/var/folders/0g/wwq2q6nn35n8vmrwhw5qfk601zlkw_/T/pip-install-tohqsyc0/lru_e04682eaa31f4d3291305bac811979b4/lru.py", line 18
raise KeyError, key
^
SyntaxError: invalid syntax
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
你知道如何修复这个错误吗?
发布于 2021-07-29 22:47:53
也遇到了同样的问题,在安装了pip install libpython3.8-dev
之后,它被修复了。对于不同版本的python,请安装相应的软件包,即pip install libpython3.6-dev
对于不同的操作系统,请参考this答案
https://stackoverflow.com/questions/65868715
复制相似问题