gpt4 book ai didi

Python——如何重命名包 music21 中的 Musescore 路径?

转载 作者:太空宇宙 更新时间:2023-11-04 05:10:48 28 4
gpt4 key购买 nike

我尝试安装 Python 包 music21,但在 Windows 中运行它时遇到问题。基本上,当我尝试运行他们作为示例给出的简单命令时

converter.parse("tinynotation: 3/4 c4 d8 f g16 a g f#").show()

我遇到了一个错误

SubConverterException: Cannot find a path to the 'mscore' file at C:\Program Files (x86)\MuseScore 2\MuseScore.exe -- download MuseScore

这是因为 Musescore.exe 不再存储在文件夹“MuseScore 2”中,而是现在在名为“bin”的子文件夹中。所以路径需要设置为“C:\Program Files (x86)\MuseScore 2\bin\MuseScore.exe”才能访问Musescore。

我该如何更改?

完全错误

SubConverterException                     Traceback (most recent call last)
<ipython-input-8-46c66c71749d> in <module>()
----> 1 converter.parse("tinynotation: 3/4 c4 d8 f g16 a g f#").show()

C:\Users\MrNoName\Anaconda3\lib\site-packages\music21\stream\__init__.py in show(self, *args, **kwargs)
255 if self.isSorted is False and self.autoSort:
256 self.sort()
--> 257 return super(Stream, self).show(*args, **kwargs)
258
259 #---------------------------------------------------------------------------

C:\Users\MrNoName\Anaconda3\lib\site-packages\music21\base.py in show(self, fmt, app, **keywords)
2586 app=app,
2587 subformats=subformats,
-> 2588 **keywords)
2589
2590 #--------------------------------------------------------------------------

C:\Users\MrNoName\Anaconda3\lib\site-packages\music21\converter\subConverters.py in show(self, obj, fmt, app, subformats, **keywords)
312
313 if 'Opus' not in obj.classes:
--> 314 fp = helperSubConverter.write(obj, helperFormat, subformats=helperSubformats)
315
316 defaults.title = savedDefaultTitle

C:\Users\MrNoName\Anaconda3\lib\site-packages\music21\converter\subConverters.py in write(self, obj, fmt, fp, subformats, **keywords)
808
809 if subformats is not None and 'png' in subformats:
--> 810 fp = self.runThroughMusescore(fp, **keywords)
811 return fp
812

C:\Users\MrNoName\Anaconda3\lib\site-packages\music21\converter\subConverters.py in runThroughMusescore(self, fp, **keywords)
756 raise SubConverterException(
757 "Cannot find a path to the 'mscore' file at " +
--> 758 "%s -- download MuseScore" % musescorePath)
759
760 fpOut = fp[0:len(fp) - 3]

SubConverterException: Cannot find a path to the 'mscore' file at C:\Program Files (x86)\MuseScore 2\MuseScore.exe -- download MuseScore

最佳答案

导入音乐后立即执行此操作21:

environment.set('musescoreDirectPNGPath', 'C:\\Program Files (x86)\\MuseScore 2\\bin\\MuseScore.exe')

关于Python——如何重命名包 music21 中的 Musescore 路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43060669/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com