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 
发布了207 篇原创文章 · 获赞 52 · 访问量 154万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 技术工厂 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览