I’m using Fedora 15 64bit and python 2.7
When I run python test.py from command line it works well
but when I run subprocess.call(["python","test.py"]) from another python module I get
File "/usr/lib64/python2.7/site.py", line 557, in <module>
main()
File "/usr/lib64/python2.7/site.py", line 539, in main
known_paths = addusersitepackages(known_paths)
File "/usr/lib64/python2.7/site.py", line 268, in addusersitepackages
user_site = getusersitepackages()
File "/usr/lib64/python2.7/site.py", line 243, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/usr/lib64/python2.7/site.py", line 233, in getuserbase
USER_BASE = get_config_var('userbase')
File "/usr/lib64/python2.7/sysconfig.py", line 535, in get_config_var
return get_config_vars().get(name)
File "/usr/lib64/python2.7/sysconfig.py", line 434, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/usr/lib64/python2.7/sysconfig.py", line 287, in _init_posix
raise IOError(msg)
IOError: invalid Python installation: unable to open /usr/local/lib64/python2.7/config/Makefile (No such file or directory)
How can I fix it?
UPDATE: This stack trace I get when run script from Eclipse.
- when I run test.py from CL – it works
- when I run script containing
subprocess.call(["python","test.py"])from CL – it also works - when I run script containing
subprocess.call(["python","test.py"])
from Eclipse – it fails
I assume you’re using something like pydev for development.
If you have a look at the “Interpreter” tab in the “Run Configurations”, you should see the python path (with the “See resulting command-line…”) and the binary used for the command. Pydev alters the PYTHONPATH (it’s not the same as you have in the command line).
I’d suggest you should try having a look inside (or even try to run the command line with the same PYTHONPATH as in pydev and see if you get the same errors.
HTH