简体   繁体   English

在Windows上安装python-midi软件包时出错

[英]Error installing python-midi package on Windows

I was trying to install some packages for python on Windows using pip and got the following error while trying to install python-midi: 我试图使用pip在Windows上为python安装一些软件包,并在尝试安装python-midi时收到以下错误:

(env) C:\Users\Asus\Documents\LEI\Algo-Rhythm>pip install python-midi
Collecting python-midi
  Using cached python-midi-v0.2.4.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Asus\AppData\Local\Temp\pip-build-zqxbr1j2\python-midi\setup.py", line 42
        print "No sequencer available for '%s' platform." % platform
                                                    ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print(print "No sequencer available for '%s' platform." % platform)?

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Asus\AppData\Local\Temp\pip-build-zqxbr1j2\python-midi\

I looked for the file where the error occurs but I can't find it even while viewing hidden files. 我查找了发生错误的文件,但是即使查看隐藏文件也找不到它。 If anybody knows what might be causing this or has experienced this issue as well I would be glad to hear. 如果有人知道是什么原因引起的,或者也遇到了此问题,我将很高兴听到。 Thanks in advance. 提前致谢。

The reason this error occurs is because this package is meant for Python 2. You can tell by the old style of print statement. 发生此错误的原因是因为此软件包是针对Python 2的。您可以通过print语句的旧样式来判断。

Python 2 Python 2

print "hey"

Python 3 Python 3

print("hey")

I'd recommend checking out python3-midi which has been forked out of the original python-midi package. 我建议您检查一下从原始python-midi软件包中派生的python3-midi

I have just updated the print statement in the setup.py file. 我刚刚更新了setup.py文件中的打印语句。

    def configure_platform():
        from sys import platform
        ns = __base__.copy()
        # currently, only the ALSA sequencer is supported
        if platform.startswith('linux'):
            setup_alsa(ns)
            pass
        else:
            print("No sequencer available for '%s' platform." % platform)
        return ns

I hope this might help you. 希望对您有所帮助。

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

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