python3.5.2 with redhat7.2

2016/7/4 11:04:40  

1. download source package
  1. [root@Rack_TestData haozil]# wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
2. System information
  1. [root@mgt haozil]# cat /etc/redhat-release
    RedHatEnterpriseLinuxServer release 7.2(Maipo)
    [root@mgt haozil]# uname -a
    Linux mgt 3.10.0-327.el7.x86_64 #1 SMP Thu Oct 29 17:29:29 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux
    [root@mgt haozil]#
3. default python version
  1. [root@mgt haozil]# python -V
    Python2.7.5
    [root@mgt haozil]# whereis python
    python:/usr/bin/python /usr/bin/python2.7/usr/lib/python2.7/usr/lib64/python2.7/etc/python /usr/include/python2.7/usr/share/man/man1/python.1.gz
    [root@mgt haozil]#
4. Install
  1. [root@mgt haozil]# tar zxvf Python-3.5.2.tgz-C /usr/local/share/
    [root@mgt haozil]# ls /usr/local/share/
    applications info man perl5 Python-3.5.2
    [root@mgt Python-3.5.2]# pwd
    /usr/local/share/Python-3.5.2
    [root@mgt Python-3.5.2]# ./configure 
    [root@mgt Python-3.5.2]# make && make install
5. Completed
  1. [root@mgt Python-3.5.2]#/usr/local/bin/python3 -V
    Python3.5.2
    [root@mgt Python-3.5.2]# python3
    Python3.5.2(default,Jul42016,15:12:54)
    [GCC 4.8.520150623(RedHat4.8.5-4)] on linux
    Type"help","copyright","credits"or"license"for more information.
    >>> exit()
6. Miss sqlite3 lib --> should install the sqlite-devel package , and then reinstall .
  1. Python build finished successfully!
    The necessary bits to build these optional modules were not found:
    _bz2 _curses _curses_panel
    _dbm _gdbm _lzma
    _sqlite3 _ssl _tkinter
    readline zlib
    To find the necessary bits, look in setup.py in detect_modules()for the module's name.
    [root@mgt Python-3.5.2]# yum install readline-devel sqlite-devel bzip2-devel.x86_64 openssl-devel.x86_64 gdbm-devel.x86_64 libdbi-devel.x86_64 ncurses-libs zlib-devel.x86_64 xz-devel.x86_64 tk-devel -y



原文地址:https://www.cnblogs.com/topshooter/p/python352_rhels72.html