linux怎么安装linux升级python2.7 2.7.12

1、下载python
wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
2、解压、编译安装
tar -zxvf Python-2.7.9.tgz
cd Python-2.7.9
./configure --prefix=/usr/local/python-2.7.9
make install
3、系统自带了python版本,我们需要为新安装的版本添加一个软链
ln -s /usr/local/python-2.7.9/bin/python /usr/bin/python2.7.9
通过命令python2.7.9查看版本:
阅读(...) 评论()Installing Python 2.7 on SLES 11 - Stack Overflow
Learn, Share, Build
Each month, over 50 million developers come to Stack Overflow to learn, share their knowledge, and build their careers.
Join the world’s largest developer community.
Display name
Email address
By registering, you agree to the
Has anyone been able to successfully install Python 2.7 on SLES 11 SP1?
If so, how?
I have tried several methods to install as follows:
Tried building from source -- this turns out to be exceedingly tedious and beyond my patience and skill level.
Tried using PythonBrew, but it gave up with errors.
Tried installing an RPM from an OpenSuse 11 repo, but it would not complete due to dependency issues.
2,55652346
Building from source is the most appropriate answer.
Your patience will pay significant dividends.
A script like the following should be sufficient ():
#!/bin/bash
# Install Python 2.7.12 alternatively
zypper install -t pattern sdk_c_c++ -y
zypper install readline-devel openssl-devel gmp-devel ncurses-devel gdbm-devel zlib-devel expat-devel libGL-devel tk tix gcc-c++ libX11-devel glibc-devel bzip2 tar tcl-devel tk-devel pkgconfig tix-devel bzip2-devel sqlite-devel autoconf db4-devel libffi-devel valgrind-devel -y
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
tar xvfz Python-2.7.12.tgz
cd Python-2.7.12
./configure --prefix=/opt/python2.7 --enable-shared
make altinstall
echo "/opt/python2.7/lib" && /etc/ld.so.conf.d/opt-python2.7.conf
rm -rf tmp
...if you encounter errors regarding the certificate chain and you have confidence that your traffic is not being intercepted, you could use the --no-check-certificate command-line option for wget.
It may be necessary because SLES11 is old enough that its openssl library may not support TLS features expected by python.org's webserver.
If you use that option, please check the tarball's signature against
(using a non-SLES11 browser if necessary).
11.9k23070
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabledlinux安装python2.7碰到问题 - linux- - ITkeyowrd
linux安装python2.7碰到问题
推荐:用的是ubuntu 12.04.跟这学习鸟哥的私房菜到了shell script那一节, 脚本如下: #!/bin/bash # Program: #
This program shows the user's choice # History:
centos 默认是2.4版本的python,重新安装python为2.7版本,碰到的问题
看完记录之后才去安装
上面的错误提示缺少zlib 库,实际上我们在上面编译安装Python结束时就应该出现了这个提示:
Python build finished, but the necessary bits to build these modules were not found:_bsddb _curses _curses_panel _sqlite3 _ssl _tkinter bsddb185 bz2 dbm gdbm readline sunaudiodev&zlib
需要启用zlib模块需要然后重新编译一下Python源码安装包:
cd /opt/Python-2.7.2vi Modules/Setup搜索zlib,去掉 #zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz 前面的注释。./configuremake
又出现错误提示:
./Modules/zlibmodule.c:112: error: ‘compobject’ has no member namedmake: *** [Modules/zlibmodule.o] Error 1
Update:上面安装zlib的方法失败,原来Python 2.7得先安装zlib库:
cd /opt/Python-2.7.2/Modules/zlib./configure make && make install
然后再重新编译安装python,也不用再编辑去掉Modules/Setup文件中的#zlib zlibmodule.c 的注释。测试一下,无错误提示:
python2.7 &&& import zlib &&& exit()
python没有SSL模块,需重新编译安装python。步骤如下
①安装openssl与openssl-devel包
yum install openssl&
yum install openssl-devel
②进入python源代码文件夹,进入Modules文件夹,
vim Setup.dist
修改推荐:*******************************************************************************
python的升级: *****************************************************
# Socket module helper for SSL you must comment out the other
# socket line above, and possibly edit the SSL variable:
#SSL=/usr/local/ssl
#_ssl _ssl.c \
# & & & &-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
# & & & &-L$(SSL)/lib -lssl -lcrypto
# Socket module helper for SSL you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/usr/local/ssl
_ssl _ssl.c \
& & & & -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
& & & & -L$(SSL)/lib -lssl -lcrypto
③重新安装python
./configure
make allmake install
推荐: os为centos6.3
Linxu下编译方法安装python
[root@lzz opt]# pwd /opt #下载解压 [root@lzz opt]# wget http://www.python.org/ftp/python/2.7.3/Python-2
centos 默认是2.4版本的python,重新安装python为2.7版本,碰到的问题
看完记录之后才去安装
Zlib 模块 上面的错误提示缺少zlib 库,实际上我们在上面编译安装Python结束时就应该出现了这个
相关阅读排行
相关内容推荐
请激活账号
为了能正常使用评论、编辑功能及以后陆续为用户提供的其他产品,请激活账号。
您的注册邮箱:
如果您没有收到激活邮件,请注意检查垃圾箱。给Linux编译安装Python2.7,SSL与zlib模块 ? Xiaoxia[PG]
我的图书馆
给Linux编译安装Python2.7,SSL与zlib模块 ? Xiaoxia[PG]
1、下载Python2.7
http://www.python.org/ftp/python/2.7/Python-2.7.tar.bz2
2、解压缩到当前目录
tar jxvf Python-2.7.tar.bz2
3、编辑Modules/Setup.dist
找到SSL和zlib模块,去掉某些注释,结果如下:
# Socket module helper for SSL you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/usr/local/ssl
ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
# Andrew Kuchling's zlib module.
# This require zlib 1.1.3 (or later).
# See http://www.gzip.org/zlib/
zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
4、安装OpenSSL
apt-get install libssl-dev
5、编译安装Python2.7
./configure
make && make install
喜欢这个文章吗?
TA的最新馆藏[转]&
喜欢该文的人也喜欢

我要回帖

更多关于 linux下安装python2.7 的文章

 

随机推荐