欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

centos7,python2和python3共存

程序员文章站 2022-08-29 22:13:59
LINUX 下python3和python2共存 1. 安装依赖包 yum install zlib devel bzip2 devel openssl devel ncurses devel sqlite devel readline devel tk devel gcc make y 2. 下载 ......

linux 下python3和python2共存

  1. 安装依赖包

    yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc* make -y

  2. 下载python安装包

    wget https://www.python.org/ftp/python/3.5.2/python-3.5.2.tar.xz

  3. 解压python安装包

    tar -jxvf python-3.5.2.tar.xz

  4. 配置安装路径

    切入到解压目录下

    ./configure prefix=/usr/local/python3

  5. 编译安装

    切入到解压目录下

    make && make install

  6. 配置软连接

    ln -s /usr/local/python3/bin/python3 /usr/bin/python3

    ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

  7. 导出之前python安装的包的清单

    pip freeze > requirements.txt

  8. 安装清单

    pip install -r requirements.txt