简体   繁体   中英

distutilscross issue when install PyAudio for cross-platform

When I installed PyAuduo for my MIPS embedded platform, I got this error:

 running build
 Traceback (most recent call last):
 File "setup.py", line 122, in <module>
 extra_link_args=extra_link_args)
 File "/usr/local/lib/python3.5/distutils/core.py", line 148, in setup
     dist.run_commands()
 File "/usr/local/lib/python3.5/distutils/dist.py", line 955, in 
   run_commands
   self.run_command(cmd)
  File "/usr/local/lib/python3.5/distutils/dist.py", line 973, in 
 run_command
   cmd_obj.ensure_finalized()
  File "/usr/local/lib/python3.5/distutils/cmd.py", line 107, in  
     ensure_finalized
   self.finalize_options()
   File "/usr/local/lib/python3.5/site-packages/distutilscross-0.1-   
    py3.5.egg/distutilscross/crosscompile.py", line 16, in finalize_options
   AttributeError: '_Environ' object has no attribute 'has_key'

It seems "crosscompile.py" cannot run python3 normally. Does anyone have idea how to modify the code in crosscompile.py to work normally in pyhton3?

how to solve AttributeError: '_Environ' object has no attribute 'has_key'

It seems like PyAudio was built in Python 2x. Python 2x had support for has_key() function to check if keys existed in dictionaries. In Python 3x, you simply do this:

if 'the_key' in os.environ:

You can potentially change this line in crosscompile.py as a quickfix and then contact the developer ( http://people.csail.mit.edu/hubert/pyaudio/#contact ).

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