CentOS 5.11 except urllib2.URLError, e: ^ SyntaxError: invalid syntax

2017-09-21

CentOS 5.11默认python 2.4,不支持except urllib2.URLError as e:,需要升级python2.7

1、python -V
Python 2.4.3
2、wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
3、tar zxf Python-2.7.12.tgz
cd Python-2.7.12
./configure --prefix=/usr/local/python2.7
make
make install
4、ln -s /usr/local/python2.7/bin/python2.7 /usr/bin

分类:Linux | 标签: |

相关日志

评论被关闭!