Think before you speak, read before you think.

python virtualenv

by

in

开发测试环境在 virtualenv 里进行。

安装 pip

yum install python-pip

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

如果遇到 ssl 错误

python get-pip.py --trusted-host pypi.python.org

指定 pypi

 pip install -i http://pypi.douban.com/simple/ autobahntestsuite --trusted-host pypi.douban.com

安装 virtualenv

sudo pip install virtualenv
pip3 install virtualenv -i https://mirrors.aliyun.com/pypi/simple

使用

virtualenv venv
source venv/bin/activate

现在已经进入 venv,安装需要的模块

pip install flask
pip install redis

将现有的模块 freeze 下来

pip freeze > requirements.txt

退出虚拟环境

deactivate

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *