文档章节

linux-Ubuntu14.04-安装python2+/python3+及创建python2 和python3 的虚拟环境

o
 osc_wws45aot
发布于 2019/08/20 15:01
字数 416
阅读 7
收藏 0

精选30+云产品,助力企业轻松上云!>>>

1、安装Python2.+ 和 Python 3.+

先创建安装目录:

sudo mkdir -p /data/project/tools
cd /data/project/tools

下载对应的安装包
sudo wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz
sudo wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz


apt-get update

sudo apt-get install -y zlib1g zlib1g-dbg zlib1g-dev zlib-bin zlibc zlib-gst
sudo apt-get install -y bison build-essential bzip2 curl flex g++ g++-multilib gcc git gnupg gperf libbz2-dev libc6-dev libcurl3 libdbi-dev libevent-dev libffi-dev libfontconfig1-dev libfreetype6 libgdbm-dev libgl1-mesa-dev libgl1-mesa-glx libicu-dev libjpeg-dev libncurses5-dev libpng-dev libpython-all-dev:amd64 libpython-dev:amd64 libreadline-dev libreadline6 libreadline6-dev libsqlite3-dev libssl-dev libtcl8.6 libtk8.6 libx11-dev libxext-dev libxml2 libxml2-dev libxml2-utils libxslt1-dev libxslt1.1 libxtst-dev openssl perl ruby sqlite sqlite3 tcl tcl-dev tk tk-dev tofrodos tree vim x11proto-core-dev xsltproc zip zlib1g-dev libmysqld-dev
sudo apt-get install -y subversion libsvn-java libsvnkit-java


sudo tar zvxf Python-2.7.15.tgz
sudo rm -rvR /usr/local/lib/python2.7
cd Python-2.7.15
sudo ./configure --prefix=/usr/local --enable-optimizations
sudo make
sudo make install
sudo make clean


cd /data/project/tools

sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python get-pip.py

sudo pip install virtualenv

 

tar zvxf Python-3.6.5.tgz
cd Python-3.6.5
sudo ./configure --prefix=/usr/local --enable-optimizations
sudo make
sudo make install
sudo make clean


pip3.6 install --upgrade pip
pip3.6 install wheel virtualenv

 

2、配置Stock、Chatbot、ChatbotCMS虚拟环境

cd /data/project/
virtualenv -p /usr/local/bin/python2.7 Stock
virtualenv -p /usr/local/bin/python3.6 Chatbot
virtualenv -p /usr/local/bin/python2.7 ChatbotCMS
virtualenv -p /usr/local/bin/python2.7 WeChat

 

3.# 增加pip源为阿里云

mkdir -p ~/.pip/
vi ~/.pip/pip.conf

内容:

[global]
index-url = http://mirrors.aliyun.com/pypi/simple

[install]
trusted-host=mirrors.aliyun.com

4.更新源

sudo vi /etc/apt/sources.list


内容:
#aliyun
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse


sudo apt-get update

 

o
粉丝 0
博文 500
码字总数 0
作品 0
私信 提问
加载中
请先登录后再评论。

暂无文章

Java线程池

前言 Java中对线程池的抽象是ThreadPoolExecutor类,Executors是一个工具类,内置了多种创建线程池的方法: newFixedThreadPool:固定长度线程池 newCachedThreadPool :可缓存线程池 newSin...

nullpointerxyz
25分钟前
35
0
Python笔记:用Python制作二维码

这些年,二维码在我国的日常使用频率特别大。因为其具有简单及安全性吧!除了用网络工具制作二维码,其实用JavaScript或Python也可以制作二维码,而且更有个性。 示例一(制作普通黑白二维码...

tengyulong
36分钟前
0
0
Redis-初体验/数据结构

定义: Redis 是 C 语言开发的一个开源的(遵从 BSD 协议)高性能键值对(key-value)的内存数据库,可以用作数据库、缓存、消息中间件等。它是一种 NoSQL(not-only sql,泛指非关系型数据库...

心田已荒
39分钟前
15
0
如何在保留订单的同时从列表中删除重复项? - How do you remove duplicates from a list whilst preserving order?

问题: Is there a built-in that removes duplicates from list in Python, whilst preserving order? 是否有内置的程序在保留顺序的同时从Python列表中删除重复项? I know that I can us...

fyin1314
今天
29
0
以太坊智能合约开发常见的10个安全问题

本文介绍CheckMarx安全研究小组通过扫描公开的以太坊智能合约所发现的Solidity智能合约开发中常见的十大安全问题,其中__未检查的外部调用__ 和 高成本循环 分列排行榜前两名。该安全问题排行...

区块链教程
今天
19
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部