A memo with Python2.7 and Python3 on CentOS

Since Python 2.6 is included in the standard of CentOS 6.5 and Python 2.7 is included in CentOS 7.2, there are various inconveniences, so install a new version and a frequently used version.

The installation destination is / opt / local.

** Addendum **

2020/01/10 Addendum: Let's use sloppy Python3.

Install Developer Tools

# yum groupinstall "Development tools"
# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel

Python 2.7, 3.6 install

First download and install them.

curl -O https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz
curl -O https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
tar zxf Python-3.6.6.tgz 
tar zxf Python-2.7.6.tgz 

Install Python2.7

cd Python-2.7.6
./configure --prefix=/opt/local
make && make altinstall

Install Python3.6

cd Python-3.6.6
./configure --prefix=/opt/local
make && make altinstall

Have Easy_install installed

(2015/07/19: Change the link destination of distribute. Thanks @ mtomoaki_96kg: +1 :)

curl -O https://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz
tar xzf distribute-0.6.49.tar.gz
cd distribute-0.6.49
/opt/local/bin/python2.7 ./distribute_setup.py 
/opt/local/bin/python3.3 ./distribute_setup.py 

2015/07/19 Addendum: PIP can be installed without installing distribute / setuptools, so you can skip this step without any problem. Rather, you can install it by running the command pip install distribute with pip.

see: https://pypi.python.org/pypi/distribute/0.6.49

Install PIP

(Added on 2014/09/27) (2015/04/22 changed from raw.github.com to raw.githubusercontent.com) (2015/07/19 Changed from github to pypa link see: https://pip.pypa.io/en/latest/installing/#install-pip)

> curl -kL https://bootstrap.pypa.io/get-pip.py | /opt/local/bin/python2.7
> curl -kL https://bootstrap.pypa.io/get-pip.py | /opt/local/bin/python3.6

Install VirtualEnv

/opt/local/bin/pip2.7 install virtualenv
/opt/local/bin/pip3.6 install virtualenv 

thanks sahiruha: +1:

reference

--http://www.petitec.com/2013/04/ Put python2-7 in centos6 /

Update log

2018/10/04: The Python version number recommended by PIP was> = 2.7.9,> = 3.4, so the part described as 3.3 was changed to 3.6.

Recommended Posts

A memo with Python2.7 and Python3 on CentOS
Build a python environment with ansible on centos6
Create a python environment on centos
Build a python3 environment on CentOS7
[Memo] Tweet on twitter with python
Map rent information on a map with python
CentOS 6.4 with Python 2.7.3 with Apache with mod_wsgi and Django
Build a Python environment on your Mac with Anaconda and PyCharm
Get data from MySQL on a VPS with Python 3 and SQLAlchemy
Install Python3.4 on CentOS 6.6
Install Python 2.7.3 on CentOS 5.4
A memo of a tutorial on running python on heroku
Building a python environment with virtualenv and direnv
[Ansible] Install dnf on Centos7 with Python3 interpreter
Install OpenCV 4.0 and Python 3.7 on Windows 10 with Anaconda
Folium: Visualize data on a map with Python
A memo when creating a python environment with miniconda
Launch a web server with Python and Flask
Run Flask on CentOS with python3.4, Gunicorn + Nginx.
Reading and writing fits files with Python (memo)
Decrypt a string encrypted on iOS with Python
Visualize grib2 on a map with python (matplotlib)
Deploy a Python app on Google App Engine and integrate it with GitHub
Create a Python3 environment with pyenv on Mac and display a NetworkX graph
Initial settings for using Python3.8 and pip on CentOS8
Programming with Python and Tkinter
I tried to make a periodical process with CentOS7, Selenium, Python and Chrome
Encryption and decryption with Python
A memo connected to HiveServer2 of EMR with python
Python on Ruby and angry Ruby on Python
Twitter graphing memo with Python
Notes on HDR and RAW image processing with Python
Build a python virtual environment with virtualenv and virtualenvwrapper
Build a Python + bottle + MySQL environment with Docker on RaspberryPi3! [Trial and error]
Install Python 3.8 on CentOS 7 (SCL)
Python and ruby slice memo
Let's make a simple game with Python 3 and iPhone
Automatic follow on Twitter with python and selenium! (RPA)
Make a breakpoint on the c layer with python
I made a Python3 environment on Ubuntu with direnv.
Get comments on youtube Live with [python] and [pytchat]!
Install Python 3.7 and Django 3.0 (CentOS)
I made a LINE BOT with Python and Heroku
Build a flask app made with tensorflow and dlib to work on centos7
Make a fortune with Python
Build a python virtual environment with virtualenv and virtualenvwrapper
[Python] A memo to write CSV vertically with Pandas
Ubuntu 20.04 on raspberry pi 4 with OpenCV and use with python
A memo that I touched the Datastore with python
A note on speeding up Python code with Numba
Email hipchat with postfix, fluentd and python on Azure
A memo about building a Django (Python) application with Docker
Automate Chrome with Python and Selenium on your Chromebook
Install Python 3.8 on CentOS 8 (AppStream)
python with pyenv and venv
Create a directory with python
Create a decent shell and python environment on Windows
Until you install Python with pythonbrew and run Flask on a WSGI server
Making a paper craft on Linux/macOS with OSS Memo
Notes on installing Python on CentOS
Works with Python and R