MAC

安装 python 3.x

brew install python3

升级 3.5

brew update

sudo chown -R $(whoami):admin /usr/local

brew upgrade python3

创建虚拟

pip install virtualenv

pyvenv-3.5 ./develop/py35env

模块 install

freeze Output installed packages in requirements format.

~/develop/py35env/bin/pip3 freeze > requirements.txt

pip install [options] -r [package-index-options] ...

~/develop/py35env/bin/pip3 install -r requirements.txt

模块

  • jupyter ./develop/py35env/bin/pip3 install jupyter ./develop/py35env/bin/jupyter-notebook
  • ipython
  • Beautiful 一个可以从HTML或XML文件中提取数据的Python库
  • motor for mongodb(支持异步)
  • Tornado-MySQL PyMySQL fork for Tornado
  • Markdown 扩展 markdown2html
  • misaka markdown2html

  • You-Get 命令行实用程序从网络下载媒体内容(视频,音频,图像)

https://github.com/vmg/sundown

CentOS

# 下载Python源(Download Python source)
$wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz

# 提取Python包(Extract Python package):
$tar xf Python-3.5.1.tar.xz

$xz -d Python-3.5.1.tar.xz

$cd Python-3.5.1

# 编译的Python(Compile Python):
$./configure

# Make:
$make

# 安装(Install):
$make install

# 检查Python版本(Check Python version):
$which python3.5
/usr/local/bin/python3.5

ubuntu

apt-get install libssl-dev

apt-get install python3-pip


apt-cache search pyvenv python3.4-venv - Interactive high-level object-oriented language (pyvenv binary, version 3.4) python3.5-venv - Interactive high-level object-oriented language (pyvenv binary, version 3.5)

apt-cache search pyvenv

apt-get install python3.5-dev

Flask

安装

pip3 install Flask

DOC

Tornado

部署

ngingx + gunicorn

source py35env/bin/activate

deactivate

ngingx + uwsgi

supervisor


ps -ef |grep super

apt-get install supervisor

/usr/bin/supervisord --supervisor服务守护进程 /usr/bin/supervisorctl --supervisor服务控制程序,比如:status/start/stop/restartxx等 /etc/supervisor/supervisord.conf --配置文件,定义服务名称以及接口等等

supervisorctl -c /etc/supervisor/supervisord.conf restart all

supervisord supervisorctl reload


ngin

/etc/nginx/conf.d/nginx.conf

Web服务

python -m SimpleHTTPServer