0
I am using openSUSE Leap 15 and I'm trying to build Python 3.7.2 from source by following this guide.
In doing so, I've taken these instructions:
- Download the archive
Extract the archive into
/usr/lib64/
as root with# cd /usr/lib64 # tar xvf /home/george/Downloads/Python-3.7.2.tgz
Run the setup commands as root
# cd Python-3.7.2 # ./configure --enable-optimizations --with-ensurepip=install # make -j 8 # make install
These commands don't give me any errors, but they don't do what I expect them to do either. They're supposed to install the new python binary into /usr/bin/python3.7
, however, that file is never created. Instead, the files are put in /usr/local/bin/
as follows:
# ls -l /usr/local/bin/ | grep python
lrwxrwxrwx 1 root root 9 Mar 31 18:18 python3 -> python3.7
-rwxr-xr-x 2 root root 14655464 Mar 31 18:28 python3.7
lrwxrwxrwx 1 root root 17 Mar 31 18:18 python3.7-config ->
python3.7m-config
-rwxr-xr-x 2 root root 14655464 Mar 31 18:28 python3.7m
-rwxr-xr-x 1 root root 3099 Mar 31 18:29 python3.7m-config
lrwxrwxrwx 1 root root 16 Mar 31 18:18 python3-config -> python3.7-config
How can I get the binaries to go to /usr/bin/
instead?
I tried creating a symlink in /usr/bin/python3.7
to point to the one in /usr/local/bin/
but when I run it, I get an error:
# python3.7
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python 3.7.2 (default, Mar 31 2019, 18:10:07)
[GCC 7.3.1 20180323 [gcc-7-branch revision 258812]] on linux
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
File "/etc/pythonstart", line 7, in <module>
import readline
ModuleNotFoundError: No module named 'readline'
>>>
Trying to set up a virtual environment on this failed as well.
I considered moving all the python3.7 files that are in /usr/local/bin/
to /usr/bin
, but I am concerned because python3.6 is already in there and each version has different other related binary files (like python3.7m-config
).
Do you get the same error if you
import readline
in the non-symlinked version. (The one in/usr/local/bin
) – timotree – 2019-04-01T01:15:53.133Yes, it does the same thing in the non-sym-linked version, module not found. – George Olson – 2019-04-01T17:58:58.493
You should be able to select the install destination using the
--prefix
option ofconfigure
. For instance:./configure --prefix=/usr/bin
. That said, I think that/usr/bin
is normally only for things installed by the distribution's official packaging system. You may have issues in the future if you do so. – bli – 2019-11-04T15:02:47.810