首页 > 编程语言 > 详细

[Python] Manage Dependencies with Python Virtual Environments

时间:2017-12-09 18:50:11      阅读:219      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!