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

时间:2018-03-29 23:53:44

标签: python windows pip install 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\

我查找了发生错误的文件,但即使在查看隐藏文件时也找不到它。如果有人知道可能导致这个问题或者遇到过这个问题,我会很高兴听到。提前谢谢。

2 个答案:

答案 0 :(得分:1)

发生此错误的原因是因为此程序包适用于Python 2.您可以通过旧样式的print语句来判断。

Python 2

print "hey"

Python 3

print("hey")

我建议您查看已从原始python-midi包中分出的python3-midi

答案 1 :(得分:0)

我刚刚更新了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

希望这对您有所帮助。