Linux安装python2.7

官网地址:https://www.python.org/downloads/

1、Linux下安装(其他系统请自行前往官网安装)

--- 安装依赖包
# cd /usr/local
# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make -y
# wget https://www.python.org/ftp/python/2.7.7/Python-2.7.7.tgz
# tar -xzvf Python-2.7.7.tgz
# cd Python-2.7.7
# ./configure --prefix=/usr/local/Python2.7 --enable-shared -enable-unicode=ucs4
# make
# make install
# python -V

2、python解释器指向python2.7

# which python
# cd /usr/bin
# rm python
# ln -s /usr/local/Python2.7/bin/python python
# python -V  --执行报错

3、解决python -V执行报错

# cd /etc/ld.so.conf.d/
# echo "/usr/local/Python2.7/lib" > python2.7.conf
# ldconfig
# python -V 

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

扫码关注云+社区

领取腾讯云代金券