2017最新白帽子教程,持续更新中~~~

centos6.9安装python3环境

vps配置 toy 26℃ 0评论

缘由:阿里云多语言版本无python3开发环境,安装python3开发环境

1、安装编译python的组件gcc等

yum install gcc
yum groupinstall "Development tools"

2、再安装依赖包

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel     readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

3、下载Python3.5的源码包并编译

wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz #其中3.5.2可修改成自己想要的版本
    tar xf Python-3.5.2.tgz
    cd Python-3.5.2
    ./configure --prefix=/usr/local --enable-shared  #把python3安装在此目录,这里注意下,后面有详解
    make
    make install

4、创建Python3.5软连接

ln –s /usr/local/bin/python3 /usr/bin/python3   #记住这些目录很重要

5、出现错误

error while loading shared libraries: xxxxxxxx: cannot open shared object file: No such file or directory(xxxx为文件名)

解决办法:我是采用修改bash_profile

export LD_LIBRARY_PATH=/usr/local/lib/

6、参考

python3安装–简书

转载请注明:链圈一盏灯 » centos6.9安装python3环境

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

表情

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

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