Install pip oracle linux

How to install Python 3 on Oracle Linux

Oracle Linux 7 doesn’t come with Python 3 by default but only with Python 2. Luckily, installing Python 3 can be done with two simple steps:

The first step installs and enables the Oracle EPEL yum repository (EPEL – Extra Packages for Enterprise Linux) which includes the Python 3.6 version. In case the repository is already installed, yum will detect that and do nothing. So nothing will go wrong if you execute the command unnecessarily or twice.

[gerald@localhost ~]$ sudo yum install -y oracle-epel-release-el7 Loaded plugins: ulninfo ol7_UEKR5 | 2.5 kB 00:00:00 ol7_latest | 2.7 kB 00:00:00 (1/5): ol7_UEKR5/x86_64/updateinfo | 33 kB 00:00:00 (2/5): ol7_latest/x86_64/group | 810 kB 00:00:00 (3/5): ol7_latest/x86_64/updateinfo | 918 kB 00:00:00 (4/5): ol7_UEKR5/x86_64/primary_db | 3.9 MB 00:00:01 (5/5): ol7_latest/x86_64/primary_db | 16 MB 00:00:02 Resolving Dependencies --> Running transaction check ---> Package oracle-epel-release-el7.x86_64 0:1.0-2.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================= Package Arch Version Repository Size ======================================================================================================================================= Installing: oracle-epel-release-el7 x86_64 1.0-2.el7 ol7_latest 14 k Transaction Summary ======================================================================================================================================= Install 1 Package Total download size: 14 k Installed size: 18 k Downloading packages: oracle-epel-release-el7-1.0-2.el7.x86_64.rpm | 14 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : oracle-epel-release-el7-1.0-2.el7.x86_64 1/1 Verifying : oracle-epel-release-el7-1.0-2.el7.x86_64 1/1 Installed: oracle-epel-release-el7.x86_64 0:1.0-2.el7 Complete! [gerald@localhost ~]$

Now you are ready to install Python 3, version 3.6 in this case:

[gerald@localhost ~]$ sudo yum install -y python36 Loaded plugins: ulninfo Resolving Dependencies --> Running transaction check ---> Package python36.x86_64 0:3.6.8-1.el7 will be installed --> Processing Dependency: python36-libs(x86-64) = 3.6.8-1.el7 for package: python36-3.6.8-1.el7.x86_64 --> Processing Dependency: libpython3.6m.so.1.0()(64bit) for package: python36-3.6.8-1.el7.x86_64 --> Running transaction check ---> Package python36-libs.x86_64 0:3.6.8-1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================= Package Arch Version Repository Size ======================================================================================================================================= Installing: python36 x86_64 3.6.8-1.el7 ol7_developer_EPEL 66 k Installing for dependencies: python36-libs x86_64 3.6.8-1.el7 ol7_developer_EPEL 8.6 M Transaction Summary ======================================================================================================================================= Install 1 Package (+1 Dependent package) Total download size: 8.6 M Installed size: 36 M Downloading packages: (1/2): python36-3.6.8-1.el7.x86_64.rpm | 66 kB 00:00:00 (2/2): python36-libs-3.6.8-1.el7.x86_64.rpm | 8.6 MB 00:00:01 --------------------------------------------------------------------------------------------------------------------------------------- Total 7.3 MB/s | 8.6 MB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : python36-libs-3.6.8-1.el7.x86_64 1/2 Installing : python36-3.6.8-1.el7.x86_64 2/2 Verifying : python36-3.6.8-1.el7.x86_64 1/2 Verifying : python36-libs-3.6.8-1.el7.x86_64 2/2 Installed: python36.x86_64 0:3.6.8-1.el7 Dependency Installed: python36-libs.x86_64 0:3.6.8-1.el7 Complete! [gerald@localhost ~]$

You can verify the installation via python36 —version :

[gerald@localhost ~]$ python36 --version Python 3.6.8 [gerald@localhost ~]$

Источник

Читайте также:  Mysql kali linux установка

Install pip oracle linux

Before installing a third-party package, verify if you can install the Python library you need from the Oracle Linux yum server. For example, to check if the requests library has been provided for Python 3:

sudo dnf search python3-requests

For more information about installing additional Python libraries from the Oracle Linux yum server, read Installing Additional Python Libraries.

If you cannot find a particular dependency on the Oracle Linux yum server, or if the script that you need to run requires a newer version of the dependency than the installed package already provides, you can use the pip package manager to install it from a third-party source.

To ensure that your system remains supported, for each project you can install and run third-party packages in an isolated virtual environment created with the virtualenv and venv Python modules.

    Create a virtual environment named example2 for Python 2:

sudo dnf install python2-virtualenv
python2 -m virtualenv --system-site-packages example2
python3 -m venv --system-site-packages example3
source example3/bin/activate
python3 -m pip install --user requests

Attention: Using the pip2 and pip3 commands outside of a virtual environment will apply your changes system-wide, and that may impact compatibility with some installed packages in your Oracle Linux 8 installation. Add the —user flag to any pip install commands to ensure that dependency packages are only available to the current user.

Источник

Install pip oracle linux

Instructions for installing Python for Linux for an on-premises Oracle database.

Python 3.9.5 required to install and use OML4Py .

These steps describe building and installing Python 3.9.5 for Linux.

    Go to the Python website and download the Gzipped source tarball . The downloaded file name is Python- 3.9.5 .tgz

wget https://www.python.org/ftp/python/3.9.5/Python-3.9.5.tgz
mkdir -p $ORACLE_HOME/python tar -xvzf Python-3.9.5.tgz --strip-components=1 -C $ORACLE_HOME/python
rpm -qa perl-Env rpm -qa libffi-devel rpm -qa openssl rpm -qa openssl-devel rpm -qa tk-devel rpm -qa xz-devel rpm -qa zlib-devel rpm -qa bzip2-devel rpm -qa readline-devel rpm -qa libuuid-devel rpm -qa ncurses-devel

If the libraries are present, then those commands should return messages such as the following. Depending on the version of Linux that you are using, such as version 7.3 or 7.5, the exact messages differ slightly.

perl-Env-1.04-2.el7.noarch libffi-devel-3.0.13-19.el7.i686 libffi-devel-3.0.13-19.el7.x86_64 openssl-devel-1.0.2k-19.0.1.el7.x86_64 tk-devel-8.5.13-6.el7.i686 xz-devel-5.2.2-1.el7.x86_64 zlib-devel-1.2.7-17.el7.x86_64 zlib-devel-1.2.7-17.el7.i686 bzip2-devel-1.0.6-13.el7.x86_64 bzip2-devel-1.0.6-13.el7.i686 readline-devel-6.2-11.el7.i686 readline-devel-6.2-11.el7.x86_64 libuuid-devel-2.23.2-61.el7_7.1.x86_64 ncurses-devel-5.9-14.20130511.el7_4.x86_64

The actual value returned depends on the version of Linux that you are using. If no output is returned, then install the packages as sudo or root user.

sudo yum install perl-Env libffi-devel openssl openssl-devel tk-devel xz-devel zlib-devel bzip2-devel readline-devel libuuid-devel ncurses-devel
cd $ORACLE_HOME/python ./configure --enable-shared --prefix=$ORACLE_HOME/python make clean; make make altinstall

Note: Be sure to use the —enable-shared flag if you are going to use Embedded Python Execution; otherwise, using an Embedded Python Execution function results in an extproc error. Be sure to invoke make altinstall instead of make install to avoid overwriting the system Python.

export PYTHONHOME=$ORACLE_HOME/python export PATH=$PYTHONHOME/bin:$PATH export LD_LIBRARY_PATH=$PYTHONHOME/lib:$LD_LIBRARY_PATH

pip will return warnings during package installation if the latest version is not installed. You can upgrade the version of pip to avoid these warnings:

python3 -m pip install --upgrade pip
cd $ORACLE_HOME/python/bin ln -s python3.9 python3

You can now start Python by running the command python3 . To verify the directory where Python is installed, use the sys.executable command from the sys package. For example:

$ python3 Python 3.9.5 (default, Feb 22 2022, 15:13:36) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44.0.3)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> print(sys.executable) /u01/app/oracle/product/19.3/dbhome_1/python/bin/python3

This returns the absolute path of the Python executable binary.

Читайте также:  Linux raid spare disk

If you run the command python3 and you get the error command not found , then that means the system cannot find an executable named python3 in $PYTHONHOME/bin . A symlink is required for the OML4Py server installation components. So, in that case, you need to create a symbolic link in your PREFIX /bin directory to link to your python3.9 executable as described in Step 6.

Источник

Installation#

If your Python environment does not have pip installed, there are 2 mechanisms to install pip supported directly by pip’s maintainers:

ensurepip #

Python comes with an ensurepip module [ 1 ] , which can install pip in a Python environment.

$ python -m ensurepip --upgrade
$ python -m ensurepip --upgrade

More details about how ensurepip works and how it can be used, is available in the standard library documentation.

get-pip.py #

This is a Python script that uses some bootstrapping logic to install pip.

  • Download the script, from https://bootstrap.pypa.io/get-pip.py.
  • Open a terminal/command prompt, cd to the folder containing the get-pip.py file and run:

More details about this script can be found in pypa/get-pip’s README.

Standalone zip application#

The zip application is currently experimental. We test that pip runs correctly in this form, but it is possible that there could be issues in some situations. We will accept bug reports in such cases, but for now the zip application should not be used in production environments.

In addition to installing pip in your environment, pip is available as a standalone zip application. This can be downloaded from https://bootstrap.pypa.io/pip/pip.pyz. There are also zip applications for specific pip versions, named pip-X.Y.Z.pyz .

The zip application can be run using any supported version of Python:

then the currently active Python interpreter will be used.

Alternative Methods#

Depending on how you installed Python, there might be other mechanisms available to you for installing pip such as using Linux package managers .

These mechanisms are provided by redistributors of pip, who may have modified pip to change its behaviour. This has been a frequent source of user confusion, since it causes a mismatch between documented behaviour in this documentation and how pip works after those modifications.

If you face issues when using Python and pip installed using these mechanisms, it is recommended to request for support from the relevant provider (eg: Linux distro community, cloud provider support channels, etc).

Upgrading pip #

Upgrade your pip by running:

$ python -m pip install --upgrade pip
$ python -m pip install --upgrade pip
C:> py -m pip install --upgrade pip

Compatibility#

The current version of pip works on:

pip is tested to work on the latest patch version of the Python interpreter, for each of the minor versions listed above. Previous patch versions are supported on a best effort approach.

Other operating systems and Python versions are not supported by pip’s maintainers.

Users who are on unsupported platforms should be aware that if they hit issues, they may have to resolve them for themselves. If they received pip from a source which provides support for their platform, they should request pip support from that source.

The ensurepip module was added to the Python standard library in Python 3.4.

Источник

Оцените статью
Adblock
detector