大家好,我要尝试从终端运行一些python代码(在IDE中不起作用)以获取.mp3文件,并根据我们使用librosa的频谱图对歌曲的流派进行分类库插件。代码来自以下gitHub:https://github.com/cetinsamet/music-genre-classification。当我使用创建该应用程序的gitHub用户指定的命令提示符时,在终端中出现此错误:
(base) Nicos-MacBook-Pro:src nico$ python3 get_genre.py ../test.mp3
Traceback (most recent call last):
File "get_genre.py", line 61, in <module>
main(sys.argv[1:])
File "get_genre.py", line 30, in main
net.load_state_dict(torch.load(MODELPATH, map_location='cpu'))
File "/Users/nico/opt/anaconda3/lib/python3.7/site-packages/torch/serialization.py", line 419, in load
f = open(f, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '../utils/net.pt'
此处是指定的命令行:$ python3 get_genre.py ../ test.mp3
答案 0 :(得分:2)
错误消息很明显地告诉您代码取决于拥有文件../utils/net.pt