centos安装python3.5

编程语言 jikk345 541℃ 0评论

1、安装依赖包

  1. [root@Qinglin-Student ~]# yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
  2. Installed:
  3. bzip2-devel.x86_64 0:1.0.5-7.el6_0 db4-devel.x86_64 0:4.7.25-20.el6_7
  4. gdbm-devel.x86_64 0:1.8.0-39.el6 libpcap-devel.x86_64 14:1.4.0-4.20130826git2dbcaa1.el6
  5. sqlite-devel.x86_64 0:3.6.20-1.el6_7.2 tk-devel.x86_64 1:8.5.7-5.el6
  6. xz-devel.x86_64 0:4.999.9-0.5.beta.20091007git.el6
  7. Dependency Installed:
  8. db4-cxx.x86_64 0:4.7.25-20.el6_7 fontconfig.x86_64 0:2.8.0-5.el6 fontconfig-devel.x86_64 0:2.8.0-5.el6
  9. freetype.x86_64 0:2.3.11-17.el6 freetype-devel.x86_64 0:2.3.11-17.el6 libX11.x86_64 0:1.6.3-2.el6
  10. libX11-common.noarch 0:1.6.3-2.el6 libX11-devel.x86_64 0:1.6.3-2.el6 libXau.x86_64 0:1.0.6-4.el6
  11. libXau-devel.x86_64 0:1.0.6-4.el6 libXft.x86_64 0:2.3.2-1.el6 libXft-devel.x86_64 0:2.3.2-1.el6
  12. libXrender.x86_64 0:0.9.8-2.1.el6_8.1 libXrender-devel.x86_64 0:0.9.8-2.1.el6_8.1 libxcb.x86_64 0:1.11-2.el6
  13. libxcb-devel.x86_64 0:1.11-2.el6 tcl.x86_64 1:8.5.7-6.el6 tcl-devel.x86_64 1:8.5.7-6.el6
  14. tk.x86_64 1:8.5.7-5.el6 xorg-x11-proto-devel.noarch 0:7.7-13.el6
  15. Dependency Updated:
  16. db4.x86_64 0:4.7.25-20.el6_7 db4-utils.x86_64 0:4.7.25-20.el6_7 gdbm.x86_64 0:1.8.0-39.el6
  17. libpcap.x86_64 14:1.4.0-4.20130826git2dbcaa1.el6 sqlite.x86_64 0:3.6.20-1.el6_7.2

2、下载并安装python3.5
下载地址:https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz

  1. [root@Qinglin-Student qinglin]# wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
  2. [root@Qinglin-Student qinglin]# tar -zxvf Python-3.5.2.tgz
  3. [root@Qinglin-Student Python-3.5.2]# ./configure --prefix=/usr/local --enable-shared
  4. [root@Qinglin-Student Python-3.5.2]# make
  5. [root@Qinglin-Student Python-3.5.2]# make install
  6. [root@Qinglin-Student Python-3.5.2]# ln -s /usr/local/bin/python3 /usr/bin/python3
在运行Python之前需要配置库并运行演示
  1. [root@Qinglin-Student Python-3.5.2]# echo /usr/local/lib >> /etc/ld.so.conf.d/local.conf
  2. [root@Qinglin-Student Python-3.5.2]# ldconfig
  3. [root@Qinglin-Student Python-3.5.2]# python3 --version
  4. Python 3.5.2
3、Python3.5替换2.6
  1. [root@Qinglin-Student python]# mv /usr/bin/python /usr/bin/python2.6
  2. [root@Qinglin-Student python]# ln -s /usr/local/bin/python3.5 /usr/bin/python
  3. [root@Qinglin-Student python]# python
  4. Python 3.5.2 (default, Sep 19 2016, 22:38:42)
  5. [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux
  6. Type "help", "copyright", "credits" or "license" for more information.
  7. >>>

转载请注明:清麟博客 » centos安装python3.5

喜欢 (0)
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址