我尝试使用包music
,我使用pip3 install music
安装了它。它正确地安装了依赖项,但现在使用了如下所示的示例代码
from music import *
# create a clarinet
clarinet = Clarinet()
# create a song
song = Song()
# add notes to the song
song.addNote(Note('C4', QUARTER))
song.addNote(Note('D4', QUARTER))
song.addNote(Note('E4', QUARTER))
我收到以下错误
Traceback (most recent call last):
File "ex.py", line 3, in <module>
from music import *
File "/home/norhther/.local/lib/python3.8/site-packages/music/__init__.py", line 1, in <module>
from . import utils, tables, synths, effects, structures, singing, core
ImportError: cannot import name 'structures' from partially initialized module 'music' (most likely due to a circular import) (/home/norhther/.local/lib/python3.8/site-packages/music/__init__.py)
1条答案
按热度按时间xxslljrj1#
看起来包的
setup.py
中有一个bug。如果你导航到安装包的文件夹,你会看到它只包含文件但根据the source code,它还有子包
我复制丢失的文件夹到安装包的文件夹后,至少我能够
import music
,但你的代码仍然不为我工作,我得到NameError: name 'Clarinet' is not defined
.