I tried to manually install Python on OpenSuSE Linux, by downloading the source, and run:
configure --prefix=/path/to/my/dir/installed/python
and
make && make install
(I have to do it this way, because I am using the server provided by my institution whereas I do not have root access to it)
This gives me the following warning:
make: warning: Clock skew detected. Your build may be incomplete.
I am not sure if the warning is related to the error I have in the future. (EDIT: This warning is gone now)
I check the installation log, I realize it give me the following error:
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/path/to/my/dir/installed/python/include -I. -IInclude -I./Include -I/usr/local/include -I/path/to/my/dir/setup/Python-2.7.11/Include -I/path/to/my/dir/setup/Python-2.7.11 -c /path/to/my/dir/setup/Python-2.7.11/Modules/_curses_panel.c -o build/temp.linux-x86_64-2.7/path/to/my/dir/setup/Python-2.7.11/Modules/_curses_panel.o
/path/to/my/dir/setup/Python-2.7.11/Modules/_curses_panel.c:17:19: fatal error: panel.h: No such file or directory
#include <panel.h>
^
compilation terminated.
Python build finished, but the necessary bits to build these modules were not found:
bsddb185 dl imageop
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Now I run python by
/path/to/my/dir/installed/python/bin/python
It give me the following error:
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python 2.7.13 (default, May 26 2017, 18:16:53)
[GCC 4.8.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
File "/etc/pythonstart", line 7, in <module>
import readline
ImportError: No module named readline
I tried to fix this error using How can I troubleshoot Python "Could not find platform independent libraries <prefix>" as well as some similar links, and set my environmental variable to be:
export PYTHONPATH='/path/to/my/dir/installed/python/lib/:/path/to/my/dir/installed/python/lib/lib-dynload:/path/to/my/dir/installed/python/lib/python2.7/site-packages'
export PYTHONHOME='/path/to/my/dir/installed/python/lib
Now if I run python, it would give me this error:
ImportError: No module named site
I search on the Stackoverflow for solution for the latter one, but they just tell me to go back to unset the $PYTHONHOME
and $PYTHONPATH
...
I've also tried to reset the two path to some other locations, none of it works.
For your information, if I unset the path, and run python, it will still output the previous "could not find dependent libraries" error, and if I try to find the path it provides:
>>>import sys
>>>sys.path
['', '/path/to/my/dir/installed/python/lib/python27.zip',
'/path/to/my/dir/installed/python/lib/python2.7',
'/path/to/my/dir/installed/python/lib/python2.7/plat-linux2',
'/path/to/my/dir/installed/python/lib/python2.7/lib-tk',
'/path/to/my/dir/installed/python/lib/python2.7/lib-old',
'/path/to/my/dir/installed/python/lib/lib-dynload',
'/path/to/my/dir/installed/python/lib/python2.7/site-packages']