8/8/2019 Centos Install Python 3.7
Python is a powerful programming language. It is very friendly and easy to learn. At writing time of this article Python 3.7.3 latest stable version is available to download and install. This tutorial will help you to install Python 3.7.3 on your CentOS, Red Hat & Fedora operating systems.
Install Python3 and pip3 on CentOS 7. November 29, 2016 - 4:24 pm January 26, 2017Linux, Python. CentOS 7 still have Python 2.7 as the default tool. EPEL repository comes up with Python 3. Thanks to EPEL repo. Here’s the way to setup Python 3 and pip3 on CentOS environment. Install python34 and python-pip package.
Step 1 – Requirements
This Python installation required GCC compiler on your system. Login to your server using ssh or shell access. Now, use the following command to install prerequisites for Python before installing it.
Step 2 – Download Python 3.7
Download Python using the following command from the Python official site. You can also download the latest version in place of specified below.
Now extract the downloaded package.
Step 3 – Install Python 3.7
Use below set of commands to compile Python source code on your system using altinstall.
![]()
make altinstall is used to prevent replacing the default python binary file /usr/bin/python.
Now remove downloaded source archive file from your system
Step 4 – Check Python Version
Check the latest version installed of python. Use command python3.7 instead of just python.
CentOS 7 EPEL now includes Python 3.4:
yum install python34
However, when I try that, even though Python 3.4 installs successfully, it doesn't appear to install pip. Which is weird, because
pip should be included by default with Python 3.4. which pip3 doesn't find anything, nor does which pip .
How do I access pip from the Python 3.4 package in CentOS 7 EPEL release?
Jeff Widman
Jeff WidmanJeff Widman
9 Answers
The easiest way I've found to install pip3 (for python3.x packages) on CentOS 7 is:
You'll need to have the EPEL repository enabled before hand, of course.
You should now be able to run commands like the following to install packages for python3.x:
foobrewfoobrew
Or if you don't have
curl for some reason:
After this you should be able to run
DevOopsDevOops
![]()
The CentOS 7 yum package for python34 does include the
ensurepip module, but for some reason is missing the setuptools and pip files that should be a part of that module. To fix, download the latest wheels from PyPI into the module's _bundled directory (/lib64/python3.4/ensurepip/_bundled/ ):
then edit
__init__.py to match the downloaded versions:
after which
python3.4 -m ensurepip works as intended. Ensurepip is invoked automatically every time you create a virtual environment, for example:
Hopefully RH will fix the broken Python3.4 yum package so that manual patching isn't needed.
DaveDave
Update: The python34 bug mentioned below has finally been fixed. It is a perfectly fine choice now.
Rather than using broken EPEL python34 packages, you can enable the IUS repo and have it work properly.
The main
python34u and python35u IUS packages include the pyvenv tool (/usr/bin/pyvenv-3.4 or /usr/bin/pyvenv-3.5 ) that includes bundled wheels of pip and setuptools for bootstrapping virtual environments.
The
python34u-pip and python35u-pip IUS packages include /usr/bin/pip3.4 and /usr/bin/pip3.5 respectively. These work just fine to install packages to the system site-packages directory.
carlwgeorgecarlwgeorge
You will likely need the EPEL repositories installed:
yum install -y epel-release
Shen YuShen Yu
There is a easy way of doing this by just using easy_install (A Setuptools to package python librarie).
That's Great. Now you have pip :)
Sundar GsvSundar Gsv
Figure out what version of python3 you have installed:
and then install the best match. Use reqoquery to find name of resulting pip3.e.g
tells me to use pip3.6 instead of pip3
gerardwgerardw
Below are the steps I followed to install python34 and pip
user2412711user2412711
On CentOS 7, the
pip version is pip3.4 and is located here:
user1631898user1631898
Not the answer you're looking for? Browse other questions tagged pippython-3.4centos7 or ask your own question.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |