• Centos7使用Python3


    1.安装python3替换python2.7

    [root@Python src]# wget https://www.python.org/ftp/python/3.5.4/Python-3.5.4.tar.xz
    [root@Python src]# yum install zlib-devel zlib openssl
    [root@Python src]# tar xf Python-3.5.4.tar.xz
    #可能需要一些库文件
    [root@Python src]# yum groupinstall "Development tools"
    [root@Python src]# yum install readline-devel
    [root@Python src]# cd Python-3.5.4/
    [root@Python Python-3.5.4]# ./configure --prefix=/usr/local/python3 --with-ssl
    [root@Python Python-3.5.4]# make && make install
    [root@Python ~]# cp /usr/bin/python2.7 /usr/bin/python2.7.bak
    [root@Python ~]# rm -f /usr/bin/python
    [root@Python ~]# ln -s /usr/local/python3/bin/python3.5 /usr/bin/python
    [root@Python ~]# vi /usr/bin/yum
    #!/usr/bin/python2
    [root@Python ~]# vi /usr/libexec/urlgrabber-ext-down
    #! /usr/bin/python2.7
    [root@Python ~]# python
    Python 3.5.4 (default, Feb  6 2018, 02:52:38) 
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 

    2. 安装pip3

    #安装setuptools
    [root@Python src]# wget --no-check-certificate  https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26
    [root@Python src]# yum install zlib-devel zlib
    [root@Python src]# tar xf setuptools-19.6.tar.gz 
    [root@Python src]# cd setuptools-19.6/
    [root@Python setuptools-19.6]# python setup.py build
    [root@Python setuptools-19.6]# cd /usr/local/src/Python-3.5.4/
    [root@Python Python-3.5.4]# make && make install
    #安装pip3
    [root@Python src]# wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz
    [root@Python src]#  tar xf pip-9.0.1.tar.gz 
    [root@Python src]#  cd pip-9.0.1
    [root@Python pip-9.0.1]# python setup.py build
    [root@Python pip-9.0.1]# python setup.py install
    #基本安装完成
    [root@Python pip-9.0.1]# python -m pip install paramiko
    pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
    Collecting paramiko
      Could not fetch URL https://pypi.python.org/simple/paramiko/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
      Could not find a version that satisfies the requirement paramiko (from versions: )
    No matching distribution found for paramiko
    [root@Python pip-9.0.1]# yum install openssl-devel
    [root@Python bin]# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip
    

      

      

  • 相关阅读:
    Java实现简单的图片浏览器
    ArrayList源码笔记
    JZ12 数值的整数次方算法笔记
    TCP的三次握手与四次挥手学习笔记
    Deepin安装LAMP环境
    Deepin安装Mysql(解决"没有可安装候选"问题)
    流行的Linux系统合集
    Win10超简单安装,菜鸡钊的装机经验分享
    Java入门(七)之面向对象-划重点
    Java入门(六)之常用的类
  • 原文地址:https://www.cnblogs.com/so-cool/p/8560074.html
Copyright © 2020-2023  润新知