简体   繁体   English

Python-midi 没有属性 Pattern

[英]Python-midi has no attribute Pattern

I want to use the python-midi package (from https://github.com/vishnubob/python-midi ).我想使用python-midi包(来自https://github.com/vishnubob/python-midi )。 Hwever there is an error when I use it.但是我在使用时出现错误。

import midi
pattern = midi.Pattern()

When I run it, I have the following error:当我运行它时,出现以下错误:

pattern = midi.Pattern()
AttributeError: 'module' object has no attribute 'Pattern'

I tried to install this package with:我尝试使用以下命令安装此软件包:

  • pip install git+https://github.com/vishnubob/python-midi@feature/python3
  • pip install python-midi
  • python setup.py install (in downloading the projet) python setup.py install (在下载项目中)

Thank you in advance for your help.预先感谢您的帮助。

I found the solution.我找到了解决方案。 I use this command " pip freeze " to know wihch packages I downloaded.我使用这个命令“ pip freeze ”来了解我下载的包。 Then I uninstall all packages concerning midi.然后我卸载所有关于midi的包。 And finally I downloaded the package with this command " sudo -H pip install python-midi ".最后我用这个命令“ sudo -H pip install python-midi ”下载了这个包。 And I have no issues when I run my code anymore.当我再运行我的代码时,我没有任何问题。 We can also do if we use python3:如果我们使用python3,我们也可以这样做:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM