まず、 linux
システムには python2
が付属しているので、 python
コマンドを直接使用できます。python2
のインストールはアンインストールできないことに注意してください。
rpm
sudo yum install zlib-devel bzip2-devel sqlite sqlite-devel openssl-devel
deb
sudo apt-get install make build-essential libssl-dev zlib1g-dev libbz2-dev libsqlite3-dev
最初に依存関係を最初にインストールしてから、 python
をインストールしても pip
は自動的にインストールされません
ftp
サイト
https://www.python.org/ftp/python
上記のページでダウンロードする必要のあるパッケージを見つけて、コマンドを使用します
wget https://www.python.org/ftp/python/3.5.4/Python-3.5.4.tar.xz
ダウンロードが完了すると、 wget
コマンドが現在実行されているディレクトリにダウンロードされたファイルが表示されます。
次に、次のように解凍する tar
コマンド
tar -xf Python-3.5.4.tar.xz
Python-3.5.4
という名前のフォルダを取得します
/ usr / local / python3 /
を作成したパスなど、インストールファイルを保存する必要のあるフォルダを作成します
mkdir -p /usr/local/python3
次に、 cd
は Python-3.5.4
に入ります
コンパイルしてインストール
sudo ./configure --prefix=/usr/local/python3/
sudo make
sudo make install
make install
を実行すると、出力は次のようになります。
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-9.0.1 setuptools-28.8.0[root@10-9-183-29 Python-3.5.4]#
つまり、インストールが完了し、 pip
がインストールされます
次に、次のようなインストールパスの構造情報を確認します。
[ root@10-9-183-29 Python-3.5.4]# cd /usr/local/python3/[root@10-9-183-29 python3]# ls
bin include lib share
[ root@10-9-183-29 python3]#
[ root@10-9-183-29 python3]# cd bin
[ root@10-9-183-29 bin]# ls
2 to3 2to3-3.5 easy_install-3.5 idle3 idle3.5 pip3 pip3.5 pydoc3 pydoc3.5 python3 python3.5 python3.5-config python3.5m python3.5m-config python3-config pyvenv pyvenv-3.5[root@10-9-183-29 bin]# ls -l
total 24128
lrwxrwxrwx 1 root root 8 Sep 310:25 2to3 -> 2to3-3.5-rwxr-xr-x 1 root root 109 Sep 310:25 2to3-3.5-rwxr-xr-x 1 root root 250 Sep 310:25 easy_install-3.5
lrwxrwxrwx 1 root root 7 Sep 310:25 idle3 -> idle3.5-rwxr-xr-x 1 root root 107 Sep 310:25 idle3.5-rwxr-xr-x 1 root root 222 Sep 310:25 pip3
- rwxr-xr-x 1 root root 222 Sep 310:25 pip3.5
lrwxrwxrwx 1 root root 8 Sep 310:25 pydoc3 -> pydoc3.5-rwxr-xr-x 1 root root 92 Sep 310:25 pydoc3.5
lrwxrwxrwx 1 root root 9 Sep 310:25 python3 -> python3.5-rwxr-xr-x 2 root root 12334016 Sep 310:25 python3.5
lrwxrwxrwx 1 root root 17 Sep 310:25 python3.5-config -> python3.5m-config
- rwxr-xr-x 2 root root 12334016 Sep 310:25 python3.5m
- rwxr-xr-x 1 root root 3088 Sep 310:25 python3.5m-config
lrwxrwxrwx 1 root root 16 Sep 310:25 python3-config -> python3.5-config
lrwxrwxrwx 1 root root 10 Sep 310:25 pyvenv -> pyvenv-3.5-rwxr-xr-x 1 root root 244 Sep 310:25 pyvenv-3.5[root@10-9-183-29 bin]#
ここでは、環境変数を構成して python3
コマンドを使用できます。もちろん、ソフト接続を介して python3
コマンドを / usr / bin
ディレクトリに直接接続することもできます。
しかし、知っているために上記の出力を見てください
python3
は python3.5
のソフトリンクです
pip3にはソフト接続がありません
python3
コマンドを使用するには、 python3
ファイルを / usr / bin
ディレクトリに直接コピーします。
pip3
コマンドを使用するには、ソフト接続を作成する方法を使用できます
現在のディレクトリ(インストールディレクトリのビン)でコマンドを実行するなど
cp python3 /usr/bin/
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
これは行われます
/ usr / bin
ディレクトリで表示
[ root@10-9-183-29 bin]# ls -l | grep pip
- rwxr-xr-x.1 root root 2291 Jul 312015 lesspipe.sh
lrwxrwxrwx 1 root root 27 Sep 310:39 pip3 ->/usr/local/python3/bin/pip3
[ root@10-9-183-29 bin]# ls -l | grep python
lrwxrwxrwx 1 root root 27 Sep 310:39 pip3 ->/usr/local/python3/bin/pip3
lrwxrwxrwx 1 root root 7 Sep 221:42 python -> python2
lrwxrwxrwx 1 root root 9 Sep 221:42 python2 -> python2.7-rwxr-xr-x 1 root root 7216 Jul 1321:07 python2.7-rwxr-xr-x 1 root root 12334016 Sep 310:37 python3
[ root@10-9-183-29 bin]#
output:
[ root@10-9-183-29 automatic_monitor]# yum install openssl-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
10 gen |2.5 kB 00:00:00
base |3.6 kB 00:00:00
centosplus |3.4 kB 00:00:00
epel |3.2 kB 00:00:00
extras |3.4 kB 00:00:00
updates |3.4 kB 00:00:00(1/2): epel/x86_64/updateinfo |939 kB 00:00:00(2/2): epel/x86_64/primary |3.6 MB 00:00:01
epel 12663/12663
Resolving Dependencies
- - > Running transaction check
- - - > Package openssl-devel.x86_64 1:1.0.2k-12.el7 will be installed
- - > Processing Dependency: zlib-devel(x86-64)forpackage:1:openssl-devel-1.0.2k-12.el7.x86_64
- - > Processing Dependency: krb5-devel(x86-64)forpackage:1:openssl-devel-1.0.2k-12.el7.x86_64
- - > Running transaction check
- - - > Package krb5-devel.x86_64 0:1.15.1-19.el7 will be installed
- - > Processing Dependency:libkadm5(x86-64)=1.15.1-19.el7 forpackage: krb5-devel-1.15.1-19.el7.x86_64
- - > Processing Dependency: libverto-devel forpackage: krb5-devel-1.15.1-19.el7.x86_64
- - > Processing Dependency: libselinux-devel forpackage: krb5-devel-1.15.1-19.el7.x86_64
- - > Processing Dependency: libcom_err-devel forpackage: krb5-devel-1.15.1-19.el7.x86_64
- - > Processing Dependency: keyutils-libs-devel forpackage: krb5-devel-1.15.1-19.el7.x86_64
- - - > Package zlib-devel.x86_64 0:1.2.7-17.el7 will be installed
- - > Running transaction check
- - - > Package keyutils-libs-devel.x86_64 0:1.5.8-3.el7 will be installed
- - - > Package libcom_err-devel.x86_64 0:1.42.9-12.el7_5 will be installed
- - - > Package libkadm5.x86_64 0:1.15.1-19.el7 will be installed
- - - > Package libselinux-devel.x86_64 0:2.5-12.el7 will be installed
- - > Processing Dependency: libsepol-devel(x86-64)>=2.5-6forpackage: libselinux-devel-2.5-12.el7.x86_64
- - > Processing Dependency:pkgconfig(libsepol)forpackage: libselinux-devel-2.5-12.el7.x86_64
- - > Processing Dependency:pkgconfig(libpcre)forpackage: libselinux-devel-2.5-12.el7.x86_64
- - - > Package libverto-devel.x86_64 0:0.2.5-4.el7 will be installed
- - > Running transaction check
- - - > Package libsepol-devel.x86_64 0:2.5-8.1.el7 will be installed
- - - > Package pcre-devel.x86_64 0:8.32-17.el7 will be installed
- - > Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================================================================================================================================
Installing:
openssl-devel x86_64 1:1.0.2k-12.el7 base 1.5 M
Installing for dependencies:
keyutils-libs-devel x86_64 1.5.8-3.el7 base 37 k
krb5-devel x86_64 1.15.1-19.el7 updates 269 k
libcom_err-devel x86_64 1.42.9-12.el7_5 updates 31 k
libkadm5 x86_64 1.15.1-19.el7 updates 175 k
libselinux-devel x86_64 2.5-12.el7 base 186 k
libsepol-devel x86_64 2.5-8.1.el7 base 77 k
libverto-devel x86_64 0.2.5-4.el7 base 12 k
pcre-devel x86_64 8.32-17.el7 base 480 k
zlib-devel x86_64 1.2.7-17.el7 base 50 k
Transaction Summary
==============================================================================================================================================================================================================================================================================
Install 1Package(+9 Dependent packages)
Total download size:2.8 M
Installed size:6.0 M
Is this ok [y/d/N]: y
Downloading packages:(1/10): keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm |37 kB 00:00:00(2/10): libcom_err-devel-1.42.9-12.el7_5.x86_64.rpm |31 kB 00:00:00(3/10): krb5-devel-1.15.1-19.el7.x86_64.rpm |269 kB 00:00:00(4/10): libkadm5-1.15.1-19.el7.x86_64.rpm |175 kB 00:00:00(5/10): libselinux-devel-2.5-12.el7.x86_64.rpm |186 kB 00:00:00(6/10): libverto-devel-0.2.5-4.el7.x86_64.rpm |12 kB 00:00:00(7/10): libsepol-devel-2.5-8.1.el7.x86_64.rpm |77 kB 00:00:00(8/10): openssl-devel-1.0.2k-12.el7.x86_64.rpm |1.5 MB 00:00:00(9/10): zlib-devel-1.2.7-17.el7.x86_64.rpm |50 kB 00:00:00(10/10): pcre-devel-8.32-17.el7.x86_64.rpm |480 kB 00:00:00------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 11 MB/s |2.8 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : keyutils-libs-devel-1.5.8-3.el7.x86_64 1/10
Installing : libcom_err-devel-1.42.9-12.el7_5.x86_64 2/10
Installing : libkadm5-1.15.1-19.el7.x86_64 3/10
Installing : libsepol-devel-2.5-8.1.el7.x86_64 4/10
Installing : pcre-devel-8.32-17.el7.x86_64 5/10
Installing : libselinux-devel-2.5-12.el7.x86_64 6/10
Installing : libverto-devel-0.2.5-4.el7.x86_64 7/10
Installing : krb5-devel-1.15.1-19.el7.x86_64 8/10
Installing : zlib-devel-1.2.7-17.el7.x86_64 9/10
Installing :1:openssl-devel-1.0.2k-12.el7.x86_64 10/10
Verifying : krb5-devel-1.15.1-19.el7.x86_64 1/10
Verifying : zlib-devel-1.2.7-17.el7.x86_64 2/10
Verifying :1:openssl-devel-1.0.2k-12.el7.x86_64 3/10
Verifying : libverto-devel-0.2.5-4.el7.x86_64 4/10
Verifying : libselinux-devel-2.5-12.el7.x86_64 5/10
Verifying : pcre-devel-8.32-17.el7.x86_64 6/10
Verifying : libsepol-devel-2.5-8.1.el7.x86_64 7/10
Verifying : libkadm5-1.15.1-19.el7.x86_64 8/10
Verifying : libcom_err-devel-1.42.9-12.el7_5.x86_64 9/10
Verifying : keyutils-libs-devel-1.5.8-3.el7.x86_64 10/10
Installed:
openssl-devel.x86_64 1:1.0.2k-12.el7
Dependency Installed:
keyutils-libs-devel.x86_64 0:1.5.8-3.el7 krb5-devel.x86_64 0:1.15.1-19.el7 libcom_err-devel.x86_64 0:1.42.9-12.el7_5 libkadm5.x86_64 0:1.15.1-19.el7 libselinux-devel.x86_64 0:2.5-12.el7 libsepol-devel.x86_64 0:2.5-8.1.el7 libverto-devel.x86_64 0:0.2.5-4.el7
pcre-devel.x86_64 0:8.32-17.el7 zlib-devel.x86_64 0:1.2.7-17.el7
Complete![root@10-9-183-29 automatic_monitor]# yum install zlib-devel bzip2-devel sqlite sqlite-devel openssl-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package zlib-devel-1.2.7-17.el7.x86_64 already installed and latest version
Package sqlite-3.7.17-8.el7.x86_64 already installed and latest version
Package 1:openssl-devel-1.0.2k-12.el7.x86_64 already installed and latest version
Resolving Dependencies
- - > Running transaction check
- - - > Package bzip2-devel.x86_64 0:1.0.6-13.el7 will be installed
- - - > Package sqlite-devel.x86_64 0:3.7.17-8.el7 will be installed
- - > Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================================================================================================================================
Installing:
bzip2-devel x86_64 1.0.6-13.el7 base 218 k
sqlite-devel x86_64 3.7.17-8.el7 base 104 k
Transaction Summary
==============================================================================================================================================================================================================================================================================
Install 2 Packages
Total download size:322 k
Installed size:748 k
Is this ok [y/d/N]: y
Downloading packages:(1/2): bzip2-devel-1.0.6-13.el7.x86_64.rpm |218 kB 00:00:00(2/2): sqlite-devel-3.7.17-8.el7.x86_64.rpm |104 kB 00:00:00------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 2.3 MB/s |322 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : sqlite-devel-3.7.17-8.el7.x86_64 1/2
Installing : bzip2-devel-1.0.6-13.el7.x86_64 2/2
Verifying : bzip2-devel-1.0.6-13.el7.x86_64 1/2
Verifying : sqlite-devel-3.7.17-8.el7.x86_64 2/2
Installed:
bzip2-devel.x86_64 0:1.0.6-13.el7 sqlite-devel.x86_64 0:3.7.17-8.el7
Complete![root@10-9-183-29 automatic_monitor]#
この記事はWeChatパブリックアカウントからのものです:プログラマー製品
Recommended Posts