Q: Why do I get an "invalid Python installation" error on Debathena?
Answer
When running Python scripts on Debathena, you may receive the following error:
Traceback (most recent call last): File "/usr/athena/lib/python2.7/site.py", line 562, in <module> main() File "/usr/athena/lib/python2.7/site.py", line 544, in main known_paths = addusersitepackages(known_paths) File "/usr/athena/lib/python2.7/site.py", line 271, in addusersitepackages user_site = getusersitepackages() File "/usr/athena/lib/python2.7/site.py", line 246, in getusersitepackages user_base = getuserbase() # this will also set USER_BASE File "/usr/athena/lib/python2.7/site.py", line 236, in getuserbase USER_BASE = get_config_var('userbase') File "/usr/athena/lib/python2.7/sysconfig.py", line 577, in get_config_var return get_config_vars().get(name) File "/usr/athena/lib/python2.7/sysconfig.py", line 476, in get_config_vars _init_posix(_CONFIG_VARS) File "/usr/athena/lib/python2.7/sysconfig.py", line 355, in _init_posix raise IOError(msg) IOError: invalid Python installation: unable to open /usr/athena/local/include/python2.7/pyconfig.h (No such file or directory)
This occurs when invoking Python as /usr/athena/bin/python. This syntax has been deprecated since 2009, and should no longer be used. If you're calling python, please use /usr/bin/python. If you have a Python script that starts with:
#!/usr/athena/bin/python
please change it to
#!/usr/bin/python
You may also wish to use
#!/usr/bin/env python
which will run the first available python in the user's PATH.