How to Install Python 3.8 on SUSE Linux Enterprise Server 15 [SLES 15]
Introduction:
Python 3.8 is a versatile and widely used programming language. In this guide, we will walk you through the installation of Python 3.8 on SUSE Linux Enterprise Server 15 (SLES 15). We will cover two installation methods: using the standard Python 3.8 package and installing a custom Python 3.8 package. Whether you need the standard or a customized installation, we’ve got you covered.
Installing the Standard Python 3.8 Package:
Step 1: SSH into the Host System
- Begin by SSH-ing into your SLES 15 server as the root user.
Step 2: Install Python 3.8
Run the following command to install Python 3.8 using the Zypper package manager:
zypper install python3.8
Step 3: Verify Installation
- Confirm that Python 3.8 is installed correctly by checking its version:
python3.8 --version
Congratulations! You’ve successfully installed Python 3.8 using the standard package.
Installing a Custom Python 3.8 Package:
Before we proceed with the custom installation, ensure that you have the necessary developer tools and packages installed:
Step 1: Install Dependencies
- Run the following command to install the required dependencies:
zypper install gcc openssl-devel bzip2-devel libffi-devel zlib-devel make libbz2-devel gzip
Step 2: SSH and Prepare for Custom Installation
- SSH into your host system as the root user.
Step 3: Download and Decompress Python 3.8
- Change to the
/opt
directory and download Python 3.8:
cd /opt
curl -O https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tgz
tar -zxvf Python-3.8.12.tgz
Step 4: Navigate to Python 3.8 Directory
- Go to the Python 3.8 directory you just extracted:
cd Python-3.8.12
Step 5: Configure Installation Location
- Depending on your choice, run one of the following configure commands:
- For standard installation:
./configure --enable-shared
- For custom installation (replace
[***CUSTOM-INSTALL-PATH***]
with your desired path):
./configure --enable-shared --prefix=[***CUSTOM-INSTALL-PATH***]
Note: Ensure that the custom installation path is either /usr/bin
, /usr/local/python38/bin
, or /usr/local/bin
. Specify a different path using the --prefix
option if needed.
Step 6: Build Python
- Build Python 3.8 with the shared library option:
make
Step 7: Place Compiled Files
- To put the compiled files in the default location or your custom location specified using the
--prefix
option, execute the following command:
make altinstall
Step 8: Copy Shared Compiled Library Files
- Copy the shared compiled library files (
libpython3.8.so
) to the/lib64/
directory:
cp --no-clobber ./libpython3.8.so* /lib64/
- Note: The
--no-clobber
option is used to prevent overwriting of files.
Step 9: Change Permissions
- Change the permissions of the
libpython3.8.so
files with the following command:
chmod 755 /lib64/libpython3.8.so*
Step 10: Address Shared Library Error (if needed)
- If you encounter the “error while loading shared libraries: libpython3.8.so.1.0: cannot open shared object file: No such file or directory” error, you can resolve it by updating the
LD_LIBRARY_PATH
. Run the following command to do so:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
Congratulations! You’ve successfully installed a custom Python 3.8 package.
Conclusion:
Your custom Python 3.8 installation is now complete, and you’ve taken the necessary steps to ensure that it works smoothly. Python 3.8 is ready to be used on your SLES 15 system, and you can start leveraging its power for your projects and applications. Enjoy coding with Python 3.8!