Because it is Centos6, the previous installation of 3.7.x series has some problems in SSL, so consider using 3.6.x series.
Visit the official website to download the address: https://www.python.org/downloads/source/
[ root@centos6 Python-3.6.8]# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel -y
[ root@centos6 opt]# wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
[ root@centos6 opt]# tar -zxvf Python-3.6.8.tgz
[ root@centos6 Python-3.6.8]# ./configure --prefix=/usr/local/python3
[ root@centos6 Python-3.6.8]# make && make install
After the installation is complete, the file will be in the /usr/local/python3/bin/
path.
[ root@centos6 Python-3.6.8]# ls /usr/local/python3/bin/
2 to3 easy_install-3.6 idle3.6 pip3.6 pydoc3.6 python3.6 python3.6m python3-config pyvenv-3.6
2 to3-3.6 idle3 pip3 pydoc3 python3 python3.6-config python3.6m-config pyvenv
[ root@centos6 Python-3.6.8]#
[ root@centos6 bin]# ./python3.6
Python 3.6.8(default, Apr 232019,14:53:03)[GCC 4.4.720120313(Red Hat 4.4.7-23)] on linux
Type "help","copyright","credits" or "license"for more information.>>>exit()[root@centos6 bin]#
[ root@centos6 bin]# ./pip3 search redis
redis(3.2.1)- Python client for Redis key-value store
redis-completion(0.5.0)- autocomplete with redis
Set up soft connection
ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3.6``ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
After setting, it can be used globally, as follows:
[ root@centos6 bin]# ln -s /usr/local/python3/bin/python3.6/usr/bin/python3.6[root@centos6 bin]# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
[ root@centos6 bin]#
[ root@centos6 bin]# cd ~[root@centos6 ~]# ls
anaconda-ks.cfg Desktop Documents Downloads gitbook install.log install.log.syslog Music netperf-2.6.0-2.gf.el6.x86_64.rpm Pictures Public Templates tmp Videos
[ root@centos6 ~]# python3.6
Python 3.6.8(default, Apr 232019,14:53:03)[GCC 4.4.720120313(Red Hat 4.4.7-23)] on linux
Type "help","copyright","credits" or "license"for more information.>>> exit
Use exit() or Ctrl-D(i.e. EOF) to exit
>>> exit()[root@centos6 ~]# pip3 search redis
redis(3.2.1)- Python client for Redis key-value store
redis-completion(0.5.0)- autocomplete with redis
kinto-redis(2.0.0)- Kinto Redis
pip3 install --upgrade pip
[ root@centos6 ~]# pip3 install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl(1.4MB)100%|████████████████████████████████|1.4MB 122kB/s
Installing collected packages: pip
Found existing installation: pip 18.1
Uninstalling pip-18.1:
Successfully uninstalled pip-18.1
Successfully installed pip-19.0.3[root@centos6 ~]#
pip3 install ipython
After installation, you can find the binary executable file of ipython from the /usr/local/python3/bin directory.
[ root@centos6 ~]# cd /usr/local/python3/bin
[ root@centos6 bin]# ls
2 to3 easy_install-3.6 idle3.6 iptest3 ipython3 pip3 pydoc3 pygmentize python3.6 python3.6m python3-config pyvenv-3.6
2 to3-3.6 idle3 iptest ipython pip pip3.6 pydoc3.6 python3 python3.6-config python3.6m-config pyvenv
[ root@centos6 bin]# ./ipython
/usr/local/python3/lib/python3.6/site-packages/IPython/core/history.py:226: UserWarning: IPython History requires SQLite, your history will not be saved
warn("IPython History requires SQLite, your history will not be saved")
Python 3.6.8(default, Apr 232019,14:53:03)
Type 'copyright','credits' or 'license'for more information
IPython 7.4.0-- An enhanced Interactive Python. Type '?'for help.
In [1]:
ln -s /usr/local/python3/bin/ipython /usr/bin/ipython3
[ root@centos6 bin]# ln -s /usr/local/python3/bin/ipython /usr/bin/ipython3
[ root@centos6 bin]#
[ root@centos6 bin]# cd ~[root@centos6 ~]#
[ root@centos6 ~]# ls
anaconda-ks.cfg Desktop Documents Downloads gitbook install.log install.log.syslog Music netperf-2.6.0-2.gf.el6.x86_64.rpm Pictures Public Templates tmp Videos
[ root@centos6 ~]#
[ root@centos6 ~]# ipython3
/usr/local/python3/lib/python3.6/site-packages/IPython/core/history.py:226: UserWarning: IPython History requires SQLite, your history will not be saved
warn("IPython History requires SQLite, your history will not be saved")
Python 3.6.8(default, Apr 232019,14:53:03)
Type 'copyright','credits' or 'license'for more information
IPython 7.4.0-- An enhanced Interactive Python. Type '?'for help.
In [1]:
After Centos6's installation comparison between python 3.7.x and python 3.6.x, python 3.6.x has the best compatibility.
Recommended Posts