简体   繁体   中英

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:

(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 "hey"

Python 3

print("hey")

I'd recommend checking out python3-midi which has been forked out of the original python-midi package.

I have just updated the print statement in the setup.py file.

    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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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