Linux下安装Python3.6和第三方库

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux下安装Python3.6和第三方库相关的知识,希望对你有一定的参考价值。

一、安装Python-3.6.2.tgz

  1. 安装依赖环境

最小化安装Redhat6.4环境下

yum -y install    gcc make zlib-devel bzip2-devel  ncurses-devel  readline-devel

(yum -y install  gcc make zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel db4-devel gdbm-devel  libpcap-devel xz-devel)

2.mkdir -p /usr/local/python3.6

3.编译安装

tar -zxvf Python-3.6.2.tgz

cd Python-3.6.2

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

make

make install

4.设置python3.6为默认python命令,并设置yum的配置

cd /usr/bin

mv python pythonold

vi yum

将#!/usr/bin/pythono改成#!/usr/bin/pythonold

ln -s /usr/local/python3.6/bin/python3.6  python

二、安装第三方库

注:python3默认已经安装,使用方法如下:

ln -s /usr/local/python3.6/bin/easy_install-3.6 /usr/bin/easy_install

ln -s /usr/local/python3.6/bin/pip3.6 /usr/bin/pip

pip install pyreadline

easy_install pyreadline


-----------------------------------

1、安装setuptools-19.6.tar.gz

tar -zxvf setuptools-19.6.tar.gz

cd setuptools-19.6

python setup.py build

python setup.py install

2、安装pip-8.0.2.tar.gz

tar -zxvf pip-8.0.2.tar.gz

cd pip-8.0.2

python setup.py build

python setup.py install


以上是关于Linux下安装Python3.6和第三方库的主要内容,如果未能解决你的问题,请参考以下文章

Linux中安装python3.6和第三方库

python2.7和python3.6共存,使用pip安装第三方库

linux系统下安装python3及其配置

Linux 安装 python3.6

Linux安装python3.6

ubuntu系统下安装pip3及第三方库的安装