zoukankan      html  css  js  c++  java
  • Linux搭建Python环境

    一、安装python3

    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.下载Python3
    https://www.python.org/downloads/

    wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
    3.安装python3

    建议安装在/usr/local/python3

    创建目录:

    mkdir -p /usr/local/python3
    解压下载好的Python-3.x.x.tgz包(具体包名因你下载的Python具体版本不不同⽽而不不同,如:我下载的是Python3.8.0.那我这里就是Python-3.8.0.tgz)

    tar -zxvf Python-3.8.0.tgz
    4.进入解压后的目录,编译安装。

    cd Python-3.8.0
    ./configure --prefix=/usr/local/python3
    make && make install
    这一步执行结束若提示:

    ModuleNotFoundError: No module named '_ctypes'
    执行

    yum install libffi-devel -y

    5.建立python3的软链

    ln -s /usr/local/python3/bin/python3 /usr/bin/python3
    6.将/usr/local/python3/bin加入PATH

    打开

    vim ~/.bash_profile
    在.bash_profile文件末尾添加:

    PATH=$PATH:$HOME/bin:/usr/local/python3/bin

    export PATH
    按ESC,输入:wq回车退出。

    执行下面的命令,让修改的文件生效:

    source ~/.bash_profile

  • 相关阅读:
    SSH移植
    ARM PPC 交叉编译环境搭建
    CEOI2020 作战记录&题解
    [NOI2019]序列 题解
    Atcoder Dwango Programming Contest 6th 题解
    CF516D Drazil and Morning Exercise 题解
    CF568E Longest Increasing Subsequence 题解
    [IOI2013]robots 题解
    SPOJ22549 DIVFACT4
    CF590E Birthday 题解
  • 原文地址:https://www.cnblogs.com/AndyAo/p/14582797.html
Copyright © 2011-2022 走看看