|
Home | Switchboard | Unix Administration | Red Hat | TCP/IP Networks | Neoliberalism | Toxic Managers |
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and bastardization of classic Unix |
Currently Python 2.6 is installed by defult of RHEL 6.x and python 2.7 on RHEL 7.
If you need Python 3.6 you need to install it yourself. There are three ways to do it
As of November 2017, the latest Python 3.x versions available in RPMS CentOS/RHEL 7 and Debian 8/9 are 3.4 and 3.5 respectively.
|
Switchboard | ||||
Latest | |||||
Past week | |||||
Past month |
Dec 05, 2017 | stackoverflow.com
gecco ,Nov 13, 2011 at 13:53
It is easy to install it manually:
- Download (there may be newer releases on Python.org ):
$ wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz- Unzip
$ tar xf Python-3.* $ cd Python-3.*- Prepare compilation
$ ./configure- Build
$ make- Install
$ make installOR if you don't want to overwrite the
python
executable (safer, at least on some distrosyum
needspython
to be 2.x, such as for RHEL6) - you can installpython3.*
as a concurrent instance to the system default with analtinstall
:$ make altinstallNow if you want an alternative installation directory, you can pass
--prefix
to theconfigure
command.Example: for 'installing' Python in /opt/local, just add
--prefix=/opt/local
.After the
make install
step: In order to use your new Python installation, it could be, that you still have to add the [prefix]/bin to the$PATH
and [prefix]/lib to the$LD_LIBRARY_PATH
(depending of the--prefix
you passed)rajadhiraja ,Jul 9, 2012 at 17:58
You used: bzip2 -cd Python-3.2.2.tar.bz2 | tar xvf - This is also a simpler possibility: tar jxvf Python-3.2.2.tar.bz2 – rajadhiraja Jul 9 '12 at 17:58dannysauer ,Oct 29, 2014 at 21:38
The bzip2 option to tar was-y
on some early systems, before bzip2 was "officially" supported, and some systems that don't use GNU tar don't even have bzip2 support built-in (but may have bzip2 binaries). So depending on how portable things need to be, thebunzip2 -c
command (orbzip2 -cd
) may be more portable. RHEL6, as in teh question, supports-j
, so this is moot for the actual question. But for posterity... – dannysauer Oct 29 '14 at 21:38Caleb ,Jan 8, 2015 at 20:39
I got a 301 (moved) into a 404 when using the bz2 tar. I changed it to .tgz and it downloaded fine. – Caleb Jan 8 '15 at 20:39bnu ,Jun 3, 2016 at 13:10
if you getno acceptable C compiler found in $PATH when installing python
refer to http://stackoverflow.com/questions/19816275/no-acceptable-c-compiler-found-in-path-when-installing-python – bnu Jun 3 '16 at 13:10Searene ,Nov 20, 2016 at 3:44
./configure --with-ensurepip=install
to enablepip3
, or you won't havepip3
installed after compilation. – Searene Nov 20 '16 at 3:44Samuel Phan ,Apr 26, 2014 at 23:30
Installing from RPM is generally better, because:Solution 1: Red Hat & EPEL repositories
- you can install and uninstall (properly) python3.
- the installation time is way faster . If you work in a cloud environment with multiple VMs, compiling python3 on each VMs is not acceptable.
Red Hat has added Python 3.4 for CentOS 6 and 7 through the EPEL repository.
Unfortunately:
[EPEL] How to install Python 3.4 on CentOS 6 & 7
pip3
is not bundled in any RPM. You need to install it manually (see below).pyvenv
is bugged and doesn't work. You need to usevirtualenv
.sudo yum install -y epel-release sudo yum install -y python34 # Install pip3 sudo yum install -y python34-setuptools # install easy_install-3.4 sudo easy_install-3.4 pip # I guess you would like to install virtualenv or virtualenvwrapper sudo pip3 install virtualenv sudo pip3 install virtualenvwrapperIf you want to use
pyvenv
, you can do the following to installpip3
in your virtualenv:pyvenv --without-pip my_env curl https://bootstrap.pypa.io/get-pip.py | my_env/bin/pythonBut if you want to have it out-of-the-box, you can add this bash function (alias) in your
.bashrc
:pyvenv() { /usr/bin/pyvenv --without-pip $@; for env in $@; do curl https://bootstrap.pypa.io/get-pip.py | "$env/bin/python"; done; }Solution 2: IUS Community repositoriesThe IUS Community provides some up-to-date packages for RHEL & CentOS . The guys behind are from Rackspace, so I think that they are quite trustworthy...
Check the right repo for you here:
https://ius.io/GettingStarted/
[IUS] How to install Python 3.5 on CentOS 6sudo yum install -y https://centos6.iuscommunity.org/ius-release.rpm sudo yum install -y python35u python35u-pip # I guess you would like to install virtualenv or virtualenvwrapper sudo pip3.5 install virtualenv sudo pip3.5 install virtualenvwrapperNote: you have
[IUS] How to install Python 3.5 on CentOS 7pyvenv-3.5
available out-of-the-box if you don't want to usevirtualenv
.sudo yum install -y https://centos7.iuscommunity.org/ius-release.rpm sudo yum install -y python35u python35u-pip # I guess you would like to install virtualenv or virtualenvwrapper sudo pip3.5 install virtualenv sudo pip3.5 install virtualenvwrapperNote: you have
pyvenv-3.5
available out-of-the-box if you don't want to usevirtualenv
.Samuel Phan ,Jul 3, 2015 at 14:54
Fixed the IUS release package URL. they have updated the version, that's all. If they update the package again, you can check the link to their RPM from the webpage. – Samuel Phan Jul 3 '15 at 14:54Samuel Phan ,Sep 7, 2015 at 9:01
As I said, the link in your answer contains non-printable unicode characters. When I copy/paste your link, here is what I see in VIM:https://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/iu<200c><200b>s-release-1.0-14.ius.centos6.noarch.rpm
Here is the unicode character: fileformat.info/info/unicode/char/200c/index.htm The URL in my original answer works, I've just tested it. – Samuel Phan Sep 7 '15 at 9:01Loïc ,Sep 30, 2015 at 13:48
Using this solution, how would you then install pip for python34 ? – Loïc Sep 30 '15 at 13:48Samuel Phan ,Oct 1, 2015 at 21:11
Very good question, I added a comment for that. It's the best I found. If you want to stick to RPM-based installation, you should use IUS repositories for CentOS 7. They provide apython34u-pip
. – Samuel Phan Oct 1 '15 at 21:11ILMostro_7 ,May 5 at 2:27
easy_install pip3
should work--or a variation of it--to get pip3 installed without needing tocurl
a specific URL that may or may not be there (anymore). – ILMostro_7 May 5 at 2:27rsc ,Jul 29, 2012 at 11:15
In addition to gecco's answer I would change step 3 from:./configureto:
./configure --prefix=/opt/python3Then after installation you could also:
# ln -s /opt/python3/bin/python3 /usr/bin/python3It is to ensure that installation will not conflict with python installed with yum.
See explanation I have found on Internet:
http://www.hosting.com/support/linux/installing-python-3-on-centosredhat-5x-from-source
cababunga ,Feb 12, 2013 at 19:45
Why/opt
?/usr/local
specifically exists for this purpose and that's where./configure
with no explicit--prefix
will place it. – cababunga Feb 12 '13 at 19:45rsc ,Feb 13, 2013 at 11:27
@cababunga As I wrote I have been influenced by reading tutorial from specified site. Nevertheless installing python in above way may be usable - it would be a lot easier to uninstall it (it looks like uninstall target for make is not provided). Also you could easily install various versions of python3 in specified separate directories under /opt and manually set which one to use or test. – rsc Feb 13 '13 at 11:27Caleb ,Jan 8, 2015 at 21:24
You may also want to set up your PATH to contain the binaries folder. For me it wasexport PATH=$PATH:/opt/python3/bin
– Caleb Jan 8 '15 at 21:24Paul Draper ,Jan 30, 2014 at 7:52
Use the SCL repos.sudo sh -c 'wget -qO- http://people.redhat.com/bkabrda/scl_python33.repo >> /etc/yum.repos.d/scl.repo' sudo yum install python33 scl enable python27(This last command will have to be run each time you want to use python27 rather than the system default.)
snacks ,Sep 24, 2014 at 13:23
After reading the redhat docs what I needed to do was either;scl enable python33 bash
to launch a new shell which will be enabled for python 3 orscl enable python33 'python hello.py'
which will run your python file using python 3 in the current shell – snacks Sep 24 '14 at 13:23Nathan Basanese ,Aug 24, 2015 at 21:46
// , What more generic instructions would also allow the installation of Python 3.4? – Nathan Basanese Aug 24 '15 at 21:46Florian La Roche ,Feb 3, 2013 at 8:53
You can download a source RPMs and binary RPMs for RHEL6 / CentOS6 from hereThis is a backport from the newest Fedora development source rpm to RHEL6 / CentOS6
cababunga ,Feb 12, 2013 at 19:40
That's great. Thanks for your effort, Florian. Maybe runningcreaterepo
on those directories would make them even more useful for some people. – cababunga Feb 12 '13 at 19:40lyomi ,Mar 21, 2014 at 15:18
What a relief. the rpm installed perfectly. – lyomi Mar 21 '14 at 15:18Nathan Basanese ,Sep 3, 2015 at 20:45
// , How do we make a repository from that link? – Nathan Basanese Sep 3 '15 at 20:45Nathan Basanese ,Sep 3, 2015 at 21:07
// , I can confirm that this works. Hold on, I just whipped up something quick that used that URL as thebaseurl
: 0bin.net/paste/ – Nathan Basanese Sep 3 '15 at 21:07rkuska ,Jul 16, 2015 at 7:58
Python3 was recently added to EPEL7 as Python34.There is ongoing (currently) effort to make packaging guidelines about how to package things for Python3 in EPEL7.
See https://bugzilla.redhat.com/show_bug.cgi?id=1219411
and https://lists.fedoraproject.org/pipermail/python-devel/2015-July/000721.htmlNathan Basanese ,Aug 24, 2015 at 21:57
// , What's the hold-up? Pip seems like the simple way to go. – Nathan Basanese Aug 24 '15 at 21:57Mike Guerette ,Aug 27, 2015 at 13:33
Along with Python 2.7 and 3.3, Red Hat Software Collections now includes Python 3.4 - all work on both RHEL 6 and 7.RHSCL 2.0 docs are at https://access.redhat.com/documentation/en-US/Red_Hat_Software_Collections/
Plus lot of articles at developerblog.redhat.com.
edit
Follow these instructions to install Python 3.4 on RHEL 6/7 or CentOS 6/7:# 1. Install the Software Collections tools: yum install scl-utils # 2. Download a package with repository for your system. # (See the Yum Repositories on external link. For RHEL/CentOS 6:) wget https://www.softwarecollections.org/en/scls/rhscl/rh-python34/epel-6-x86_64/download/rhscl-rh-python34-epel-6-x86_64.noarch.rpm # or for RHEL/CentOS 7 wget https://www.softwarecollections.org/en/scls/rhscl/rh-python34/epel-7-x86_64/download/rhscl-rh-python34-epel-7-x86_64.noarch.rpm # 3. Install the repo package (on RHEL you will need to enable optional channel first): yum install rhscl-rh-python34-*.noarch.rpm # 4. Install the collection: yum install rh-python34 # 5. Start using software collections: scl enable rh-python34 bashNathan Basanese ,Dec 10, 2015 at 23:53
// , Doesn't this require us to enable a special shell? Combined with virtualenvs, I can see that becoming a pain in the ass. – Nathan Basanese Dec 10 '15 at 23:53Nathan Basanese ,Dec 10, 2015 at 23:55
// , Why does this requirescl enable rh-python34 bash
? What are the implications for using this later on? – Nathan Basanese Dec 10 '15 at 23:55Searene ,Nov 20, 2016 at 2:53
Is there a way to install python3.5 on RedHat 6? I triedwget https://www.softwarecollections.org/en/scls/rhscl/rh-python35/epel-6-x86_64/download/rhscl-rh-python35-epel-6-x86_64.noarch.rpm
, but it was not found. – Searene Nov 20 '16 at 2:53daneel ,Apr 2, 2015 at 14:12
If you want official RHEL packages you can use RHSCL (Red Hat Software Collections)More details:
- Guide to Python 3.3 in RHSCL 1.1
- How to access and download Red Hat Software Collections (RHSCL) and/or Red Hat Developer Toolset (DTS)?
You have to have access to Red Hat Customer Portal to read full articles.
Nathan Basanese ,Aug 24, 2015 at 21:55
// , Just upvoted. Would you be willing to make a summary of what one does to use the RHSCL for this? This is a question and answer site, after all. – Nathan Basanese Aug 24 '15 at 21:55amphibient ,Feb 8 at 17:12
yum install python34.x86_64
works if you haveepel-release
installed, which this answer explains how to, and I confirmed it worked onRHEL 7.3
$ cat /etc/*-release NAME="Red Hat Enterprise Linux Server" VERSION="7.3 (Maipo) $ type python3 python3 is hashed (/usr/bin/python3)Aty ,Feb 11 at 20:47
Here are the steps i followed to install Python3:yum install wget
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
sudo tar xvf Python-3.*
cd Python-3.*
sudo ./configure --prefix=/opt/python3
sudo make
sudo make install
sudo ln -s /opt/python3/bin/python3 /usr/bin/python3
$ /usr/bin/python3
Python 3.6.0
Nagev ,Mar 6 at 18:21
Three steps using Python 3.5 by Software Collections :sudo yum install centos-release-scl sudo yum install rh-python35 scl enable rh-python35 bashNote that sudo is not needed for the last command. Now we can see that python 3 is the default for the current shell:
python --version Python 3.5.1Simply skip the last command if you'd rather have Python 2 as the default for the current shell.
Maxime Martineau ,May 10 at 18:02
For RHEL on Amazon Linux, using python3 I had to do :sudo yum install python34-devel
Dec 05, 2017 | www.tecmint.com
Although we can install the core packages and their dependencies using yum and aptitude (or apt-get ), we will explain how to perform the installation from source instead.
Why? The reason is simple: this allows us to have the latest stable release of the language ( 3.6 ) and to provide a distribution-agnostic installation method.
Prior to installing Python in CentOS 7, let's make sure our system has all the necessary development dependencies:
# yum -y groupinstall development# yum -y install zlib-develIn Debian we will need to install gcc, make, and the zlib compression / decompression library:
# aptitude -y install gcc make zlib1g-devTo install Python 3.6 , run the following commands:
# wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.xz # tar xJf Python-3.6.3.tar.xz # cd Python-3.6.3 # ./configure # make # make install
Xmodulo
Method Two: Install Python3 from EPEL Repository
The latest EPEL 7 repository offers python3 (python 3.4 to be exact). Thus if you are using CentOS 7 or later, you can easily install python3 by enabling EPEL repository as follows.
$ sudo yum install epel-releaseThen install python 3.4 and its libraries using yum:
$ sudo yum install python34Note that this will not install matching pip. To install pip and setuptools, you need to install them separately as follows.
$ curl -O https://bootstrap.pypa.io/get-pip.py
$ sudo /usr/bin/python3.4 get-pip.pyMethod Three: Install Python3 from Software Collections (SCL)
Another way to install python3 is via enabling Software Collections (SCL) repository. The SCL repository is available for CentOS 6.5 or later, and the latest SCL offers python 3.3. Once you enable the SCL repository, go ahead and install python3 as follows.
$ sudo yum install python33To use python3 from the SCL, you need to enable python3 on a per-command basis as follows.
$ scl enable python33 <command>You can also invoke a bash shell with python3 enabled as the default Python interpreter:
Google matched content |
Society
Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers : Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism : The Iron Law of Oligarchy : Libertarian Philosophy
Quotes
War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda : SE quotes : Language Design and Programming Quotes : Random IT-related quotes : Somerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose Bierce : Bernard Shaw : Mark Twain Quotes
Bulletin:
Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 : Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law
History:
Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds : Larry Wall : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOS : Programming Languages History : PL/1 : Simula 67 : C : History of GCC development : Scripting Languages : Perl history : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history
Classic books:
The Peter Principle : Parkinson Law : 1984 : The Mythical Man-Month : How to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite
Most popular humor pages:
Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor
The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D
Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.
This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...
|
You can use PayPal to to buy a cup of coffee for authors of this site |
Disclaimer:
The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.
Last modified: December, 26, 2017