Linux安装python2.7
原创
©著作权归作者所有:来自51CTO博客作者試毅一思伟的原创作品,请联系作者获取转载授权,否则将追究法律责任
官网地址: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