Centos6であるため、以前の3.7.xシリーズのインストールではSSLにいくつかの問題があります。したがって、3.6.xシリーズの使用を検討してください。
公式ウェブサイトにアクセスしてアドレスをダウンロードしてください:[https://www.python.org/downloads/source/](https://links.jianshu.com/go?to=https%3A%2F%2Fwww.python.org%2Fdownloads%2Fsource%2F)
[ 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
インストールが完了すると、ファイルは / usr / local / python3 / bin /
パスにあります。
[ 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
ソフト接続を設定する
ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3.6``ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
設定後、次のようにグローバルに使用できます。
[ 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
インストール後、/ usr / local / python3 / binディレクトリからipythonのバイナリ実行可能ファイルを見つけることができます。
[ 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]:
Centos6のpython3.7.xとpython3.6.xのインストール比較の後、python3.6.xの互換性が最も高くなっています。
Recommended Posts