Ubuntu16.04构建Python3.6开发环境

Python is an easy to learn, powerful programming language.

Python Tutorial

安装Python3.6

Ubuntu 14.04 and 16.04

添加add-apt-repository命令

1
sudo apt-get install software-properties-common

通过PPA安装

1
2
3
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6

安装python-dev

用于避免安装包时出缺少 Python.h 而安装失败

1
sudo apt-get install python3.6-dev

安装pip

1
2
wget https://bootstrap.pypa.io/get-pip.py
python3.6 get-pip.py

安装pipenv

这个库相当于是环境管理和包管理二合一,由 Kenneth Reitz (Requests 的作者 )编写,现在移交给 Python 官方来维护,提供比 pip 体验更好的开发包管理。它的 Slogon 是Python Development Workflow for Humans,用来解决各种环境不一致、安装包的问题,可参见官方文档

1
pip3.6 install pipenv

构建pipenv环境

生成Pipfile, 添加阿里源

1
2
3
cd your-project
pipenv lock
vim Pipfile

[[source]]
url = “https://pypi.org/simple"
url = “https://mirrors.aliyun.com/pypi/simple/"
verify_ssl = true
name = “pypi”

[packages]

[dev-packages]

[requires]
python_version = “3.6”

1
2
3
pipenv install ipython
pipenv shell
ipython
0%