CentOS システム#
wget https://www.moerats.com/usr/shell/Python3/CentOS_Python3.6.sh && sh CentOS_Python3.6.sh
Debian システム#
wget https://www.moerats.com/usr/shell/Python3/Debian_Python3.6.sh && sh Debian_Python3.6.sh
Python コマンドを入力して、バージョンが Python2.7.5 であることを確認します
which python を入力します
通常、/usr/bin/python ディレクトリにあります
Python3 をインストールします
まず、依存パッケージをインストールします
yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
Python3.6.2 をダウンロードします
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
新しいフォルダを作成し、ソフトウェアを python3 フォルダに配置します mkdir /usr/local/python3
次に、圧縮ファイルを解凍し、そのディレクトリに移動して Python3 をインストールします
tar -xvJf Python-3.6.2.tar.xz
cd Python-3.6.2
./configure --prefix=/usr/local/python3
make -j && make install
シンボリックリンクを作成します
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3