[Python] Manage Dependencies with Python Virtual Environments
Posted Answer1215
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Python] Manage Dependencies with Python Virtual Environments相关的知识,希望对你有一定的参考价值。
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的主要内容,如果未能解决你的问题,请参考以下文章
初试django---python manage.py makemigrations以及python manage.py migrate
python3 manage.py runserver 错误
Pycharm $python3 manage.py runserver问题[重复]
Mac下python manage.py runsever 报错
运行python manage.py 出现mportError: No module named django.core.management when using manage.py