码迷,mamicode.com
首页 > 编程语言 > 详细

[Python] Manage Dependencies with Python Virtual Environments

时间:2017-12-09 19:19:39      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:between   tween   you   his   har   and   py3   ica   can   

Virtual Environments ensure that dependencies from one Python application don’t overwrite the dependencies of another application. In this lesson, you will learn how to create a virtual environment, switch between virtual environments, and manage dependencies within a virtual environment.

 

Install:

pip install virtualenv

 

Create floder for a project:

mkdir my_project
cd my_project

 

Use virtual env to generate python env:

virtualenv py3 -p /usr/local/bin/python3

Tell to use python3. Then it will create py3 folder.

 

To activate the env:

source py3/bin/activate

To deactivate

deactivate

 

To share the dependiences:

pip freeze > requirements.txt
pip install -r requirements.txt

So other developers can use the same dependiences

 

[Python] Manage Dependencies with Python Virtual Environments

标签:between   tween   you   his   har   and   py3   ica   can   

原文地址:http://www.cnblogs.com/Answer1215/p/8012133.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!