Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Use the virtual environments with Python

Posted on Oct 23 If you work on several Python projects, you will quickly need to have different versions of your packages, depending on the current project.Virtual Environments are designed for this, they allow to isolate the libraries between your projects. There are different libraries you can use, I will show you Venv and Pipenv.Venv is the built-in module for creating virtual environments in Python 3.First let’s create a simple script, that needs two packages :Create a file "requirements.txt" :Then you can use this commands (don’t forget to add "venv" in your .gitignore file) :Pipenv is a higher-level tool that combines package management and virtual environment management, using Pipfile.First, install Pipenv :Create a file "Pipfile", made for the script we are working on :(you can also generate it with the "pipenv install" command)Then you can use this commands :Both are good solutions for virtual environments, venv is built-in and lighter to write, also pipenv is faster and allows more possibilities, so choose the good one for the good context.You can also be interested by Pyenv, a complementary tool made to manage different versions of Python on your computer.Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse потик - Oct 1 CodeSolutionsHub - Oct 5 DocumentWrite - Oct 14 Denis Rasulev - Sep 29 Once suspended, Jdxlabs will not be able to comment or publish posts until their suspension is removed. Once unsuspended, jdxlabs will be able to comment and publish posts again. Once unpublished, all posts by jdxlabs will become hidden and only accessible to themselves. If jdxlabs is not suspended, they can still re-publish their posts from their dashboard. Note: Once unpublished, this post will become invisible to the public and only accessible to jdxlabs. They can still re-publish the post if they are not suspended. Thanks for keeping DEV Community safe. Here is what you can do to flag jdxlabs: jdxlabs consistently posts content that violates DEV Community's code of conduct because it is harassing, offensive or spammy. Unflagging jdxlabs will restore default visibility to their posts. DEV Community — A constructive and inclusive social network for software developers. With you every step of your journey. Built on Forem — the open source software that powers DEV and other inclusive communities.Made with love and Ruby on Rails. DEV Community © 2016 - 2023. We're a place where coders share, stay up-to-date and grow their careers.



This post first appeared on VedVyas Articles, please read the originial post: here

Share the post

Use the virtual environments with Python

×

Subscribe to Vedvyas Articles

Get updates delivered right to your inbox!

Thank you for your subscription

×