1. 下载并解压包
tar zxvf Python-3.7.0.tgz
2. 安装
cd python3.7 ./configure --prefix=/usr/local/python37
make
sudo make install
3. 安装虚拟环境
./bin/pip3.7 install virtualenv -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com ./bin/pip3.7 install virtualenvwrapper -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
4. 创建虚拟环境
./bin/virtualenv /usr/local/virtualenv/flask_py3 -p /usr/local/python37/bin/python3.7 --no-site-packages
或先配置虚拟环境然后用mkvirtualenv命令(不过这一个发现用的是系统默认环境,我的默认环境是2.6)
mkdir ~/.virtualenvs vim ~/.bashrc export WORKON_HOME=$HOME/.virtualenvs source /usr/local/python37/bin/virtualenvwrapper.sh source ~/.bashrc mkvirtualenv /usr/local/virtualenv/flask_py37
5. 安装flask
./bin/pip3.7 install flask -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com