2017
Sep
24

安装方式

先更新 yum package list.

yum install -y centos-release-scl
yum install -y scl-utils-build

安装 python-2 ,这里不用指定版号,因为目前 python 都会装 2.x 版。

  • yum install -y python-devel

安装 python 3.3

  • yum install -y python33 python33-devel
  • ln -sf /opt/rh/python33/root/usr/bin/python3.3 /usr/bin/python3
  • ln -sf /opt/rh/python33/root/usr/bin/python3.3 /usr/local/bin/python3

更新 Linux so linker config

  • echo "/opt/rh/python33/root/usr/lib/" >> /etc/ld.so.conf.d/ld.so.basic.conf
  • echo "/opt/rh/python33/root/usr/lib64/" >> /etc/ld.so.conf.d/ld.so.basic.conf
  • ldconfig

安装 pip-3

  • /opt/rh/python33/root/usr/bin/easy_install-3.3 pip
  • cp /opt/rh/python33/root/usr/bin/pip3.3 /usr/local/bin/

完成后,你就可以使用 python2 / python3 两个指令罗,至於 pip 我只安装 python3 的版本,因为 2 只是用来跑旧程式。

安装 python-3 module 方式:

/usr/local/bin/pip3.3 install enum34

回應 (Leave a comment)