zoukankan      html  css  js  c++  java
  • Centos Python3安装共存

    安装python3.6可能使用的依赖

    yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
    

    下载python3.6编译安装

    到python官网下载https://www.python.org

    下载最新版源码,使用make altinstall,如果使用make install,在系统中将会有两个不同版本的Python在/usr/bin/目录中。这将会导致很多问题,而且不好处理。

    wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
    xz -d Python-3.7.0.tgz.xz
    tar -xvf  Python-3.7.0.tgz
    cd  Python-3.7.0
    

    把Python3.6安装到 /usr/local 目录

    ./configure --prefix=/usr/local
    
    make
    
    make altinstall
    

    报错处理:

    • zipimport.importerror

    • yum install zlib zlib-devel

    • configure: error: no acceptable C compiler found in $PATH

      yum install gcc

    • ModuleNotFoundError: No module named '_ctypes'

    python3.6程序的执行文件:/usr/local/bin/python3.6

    python3.6应用程序目录:/usr/local/lib/python3.6

    pip3的执行文件:/usr/local/bin/pip3.6

    pyenv3的执行文件:/usr/local/bin/pyenv-3.6

    更改/usr/bin/python链接

    cd/usr/bin
    
    ln -s /usr/local/bin/python3.6 /usr/bin/python3
    ln -s /usr/local/bin/pip3.6 /usr/bin/pip3
    
  • 相关阅读:
    usaco-ariprog1-pass
    usaco-crypt1-pass
    usaco-barn-repair-pass-KISS
    usaco-mixing milk-pass
    面试HR
    LCS求最长公共子序列(DP)
    毕业随想(转载)
    0-1背包问题(DP)
    排序算法
    二叉搜索树的实现 java
  • 原文地址:https://www.cnblogs.com/tongchengbin/p/9353888.html
Copyright © 2011-2022 走看看