CentOS6.8 install python2.7

Note: I used CentOS6.8 to minimize the installation for this operation.
In order for ipython to save historical records, sqlite-devel needs to be installed

  1. Ready to work
yum -y install gcc wget xz unzip zlib-devel openssl openssl-devel sqlite-devel
  1. Download source code
wget 
https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz
  1. Unzip:
xz -d Python-2.7.12.tar.xz     
tar xf Python-2.7.12.tar     
cd Python-2.7.12./configure --prefix=/usr/local/python     
make     
make install
  1. The replacement system comes with Python
    After installation, the executable file of Python 2.7.8 is located in /usr/local/python/bin. First rename the Python that comes with the system to python2.6.6, and then create a new symbolic link from Python to the /usr/bin directory.
mv /usr/bin/python /usr/bin/python2.6.6     
ln -sv /usr/local/python/bin/python2.7/usr/bin/python
  1. Fix yum
    Now, the system calls Python 2.7.12 by default, and an error occurs when yum is executed.
    Solution: Change the first line of code at the beginning of the /usr/bin/yum file:
#! /usr/bin/python

To:

#! /usr/bin/python2.6.6

At this point python2.7.12 installation is complete
Next install ipython

ipython installation

  1. Download ipython
wget 
https://github.com/ipython/ipython/archive/master.zip
  1. Unzip and install
unzip master.zip     
cd ipython-master     
python setup.py build     
python setup.py install
  1. Create symbolic link
ln -sv /usr/local/python/bin/ipython2 /usr/bin/ipython
  1. Install pip
    At this time, if you run ipython directly, the following error will be prompted, which is caused by not installing the corresponding module:
    No module named traitlets.config.application
wget 
https://pypi.python.org/packages/9f/7c/0a33c528164f1b7ff8cf0684cf88c2e733c8ae0119ceca4a3955c7fc059d/setuptools-23.1.0.tar.gz
     
tar xf setuptools-23.1.0.tar.gz     
cd setuptools-23.1.0     
python setup.py install     
wget 
https://pypi.python.org/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb03c64707ce100ecd53934da1aa13/pip-8.1.2.tar.gz
     
tar xf pip-8.1.2.tar.gz     
cd pip-8.1.2     
python setup.py install

Create symbolic link

ln -sv /usr/local/python/bin/pip2.7/usr/bin/pip

Then execute ipython to see what module is missing and go directly

pip install module_name     
pip install traitlets     
pip install pygments     
pip install pexpect     
pip install backports.shutil_get_terminal_size     
pip install pathlib2     
pip install pickleshare     
pip install prompt_toolkit     
pip install simplegeneric

Well, the ipython environment is set up.

Recommended Posts

Centos6 install Python2.7.13
Centos7 install Python 3.6.
CentOS install Python 3.6
Centos7 install Python2.7
Centos install Python3
CentOS6.8 install python2.7
1.5 Install Centos7
Centos 7.5 python3.6
centos7 install python3 and ipython
CentOS7 install python3 and pip3
CentOS 6.9 compile and install python
CentOS 6 compile and install python 3
Centos7.3 install nginx
CentOS7.2 install Mysql5.7.13
CentOS install Redmine
CentOS7 install MySQL
ubuntu18.04 install python2
Centos7 install protobuf
CentOS 7 install Docker
CentOS7 install GlusterFS
CentOS7 upgrade python3
CentOS 7.4 install Zabbix 3.4
CentOS7 install Docker
Centos6.5 install Tomcat
ubuntu12.04 install python3
centos7 install docker-ce 18.01.0
CentOS 7.2 install MariaDB
CentOS 7 install Hadoop 3.0.0
Python - centos6 installation
Centos 7.6 install seleniu
CentOS 7.3 install Zabbix3
Centos7 install LAMP+PHPmyadmin
CentOS install mysql
CentOS install openjdk 1.8
CENTOS6.5 install CDH5.12.1 (1)
How to install Python 3.8 on CentOS 8
CentOS install PHP
CentOS6 install mist.io
CentOS7 install mysql
How to install Python on CentOS 8
Install Python3 and ansible under CentOS8
CentOS 7 install MySQL 5.6
CentOS6.5 install CDH5.13
Centos7 install docker18
centos7 install docker
CentOS install jdk
centos7 install nginx-rtmp
CentOS8 install MySQL8.0
Centos6.3 install KVM
CentOS install PostgreSQL 9.1
CentOS7 install mysql8
CentOS 7 install Java 1.8
CentOS8 install fastdfs6.06
CentOS 7 install Gitlab
Centos 7 install PostgreSQL
CentOS 7 install Java 1.8
CentOS 6 install Docker
Install Python3 and Py under CentOS7
centos 6.5 install zabbix 4.4
Centos8 install Docker
CentOS install nodejs 8