• linux 下安装python2.7.13


    1.下载所必要的依赖包

    yum -y install python-devel openssl openssl-devel gcc sqlite sqlite-devel mysql-devel libxml2-devel libxslt-devel
    
    [root@cdh1 20191018]# ll *gz
    -rwxrwxrwx 1 root root   389668 Oct 18 14:55 distribute-0.6.10.tar.gz
    -rwxrwxrwx 1 root root  1246072 Apr 20  2018 pip-10.0.1.tar.gz
    -rwxrwxrwx 1 root root 17076672 Dec 18  2016 Python-2.7.13.tgz
    -rwxrwxrwx 1 root root   796957 Apr 24  2016 setuptools-1.4.2.tar.gz
    --gz包请自动解压


    2.安装python2.7.13

    cd /tmp/20191018/Python-2.7.13
    ./configure --prefix=/usr/local/python2.7 --with-threads --enable-shared
    
    make && make altinstall
    
    mv /usr/bin/easy_install /usr/bin/easy_install2.6
    mv /usr/bin/python /usr/bin/python2.6
    
    ln -s /usr/local/python2.7/lib/libpython2.7.so /usr/lib
    ln -s /usr/local/python2.7/lib/libpython2.7.so.1.0 /usr/lib
    ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python
    ln -s /usr/local/python2.7/lib/libpython2.7.so /usr/lib64
    ln -s /usr/local/python2.7/lib/libpython2.7.so.1.0 /usr/lib64


    验证:

    [root@cdh4 Python-2.7.13]# python
    Python 2.7.13 (default, Oct 28 2019, 16:35:02)
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 


    3.安装安装setuptools

    cd /temp/20191018/setuptools-1.4.2
    python setup.py build
    python setup.py install 



    4.安装安装pip

    cd /temp/20191018/pip-10.0.1
    python setup.py build
    python setup.py install
    
    ln -s /usr/local/python2.7/bin/pip /usr/bin/pip


    测试:

    pip install Pillow


    5.修改YUM

    vim /usr/bin/yum
    #!/usr/bin/python2.6

    验证:

    [root@cdh1 20191018]# yum
    Loaded plugins: fastestmirror, security
    You need to give some command
    Usage: yum [options] COMMAND
    
    List of Commands:
    
    check          Check for problems in the rpmdb
    check-update   Check for available package updates
    clean          Remove cached data
    deplist        List a package's dependencies
    distribution-synchronization Synchronize installed packages to the latest available versions
    downgrade      downgrade a package
    erase          Remove a package or packages from your system
    groupinfo      Display details about a package group
    groupinstall   Install the packages in a group on your system
    grouplist      List available package groups
    groupremove    Remove the packages in a group from your system
    help           Display a helpful usage message

    完成!!!

  • 相关阅读:
    System.AccessViolationException”类型的第一次机会异常在 System.Data.dll 中发生 其他信息: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。
    解决浏览器显示长数字不能自动换行或长字母不能换行的问题
    索引 -1 没有值
    vrpie在Visio Studio 中无法调试的问题
    vrpie下实现vrp模型和javascript的交互
    IE下Date.parse出现NaN有关问题解决
    SQL Server 一些关键字详解(一)
    SQL Server 一些关键字详解(二)
    WPF WebBrowser 遇到的问题
    日历代码
  • 原文地址:https://www.cnblogs.com/hello-wei/p/11753353.html
Copyright © 2020-2023  润新知