zoukankan      html  css  js  c++  java
  • redhat安装python3.7

    下载并解压:

    1 wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
    2 tar -xzvf Python-3.7.2.tgz

    进入目录:

    cd Python-3.7.2

    编译:

    ./configure --prefix=/usr/local/python3

    安装:

    make
    make insatll

    缺少依赖包导致:

    执行:yum -y install zlib*  安装依赖包即可

    仍缺少组件,无法导入_ctypes模块:

    1 yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
    2 yum install libffi-devel -y

    https://cpython-devguide.readthedocs.io/setup/#build-dependencies
    注意:此步骤安装完成之后,需要重新编译文件

    安装完成之后,python已经安装成功,但是需要配置环境变量,(如果不想配置环境变量可以在编译那一步将  --prefix=/usr/local/python3 这一部分去掉【没有测试】

    创建软连接即可,

    1 [root@bing ~]# mv /usr/bin/python /usr/bin/python_bak
    2 [root@bing ~]# ln -s /usr/local/python3/bin/python3 /usr/bin/python
    3 [root@bing ~]# python
    4 Python 3.7.2 (default, Feb 23 2019, 19:05:50) 
    5 [GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux
    6 Type "help", "copyright", "credits" or "license" for more information.
    7 >>> exit()

     pip还无法使用

    1 [root@bing ~]# PATH=$PATH:$HOME/bin:
    2 [root@bing ~]# PATH=$PATH:$HOME/bin:/usr/local/python3/bin

    配置完环境变量(在本次会话中)即可使用pip,最好是创建软连接

    续;

    安装过程中出现:pip is configured with locations that require TLS/SSL, however the ssl modul

    #重新编译安装
    ./configure --prefix=/usr/local/python3 --enable-optimizations --with-ssl
    make
    make install
    #重新第三方库pymysql
    pip3 intall pymysql
  • 相关阅读:
    杜教筛
    单纯形法
    回文树
    模板综合
    不明觉厉的数据结构题2
    gedit脚本
    01分数规划入门
    LCT裸题泛做
    洛谷P4586 [FJOI2015]最小覆盖双圆问题(最小圆覆盖)
    洛谷P1742 最小圆覆盖(计算几何)
  • 原文地址:https://www.cnblogs.com/ice-image/p/10423847.html
Copyright © 2011-2022 走看看