Article 5C9GT venv, pyvenv, pyenv, virtualenv - the setup of Python on a Linux

venv, pyvenv, pyenv, virtualenv - the setup of Python on a Linux

by
rincon
from LinuxQuestions.org on (#5C9GT)

Hello dear Community,*
*

about the install and using Python packages ::: difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv, etc?

*
here some musings about*how to install and using Python packages - approach - and subsequently - some questions:*

first we give an overview:

at the preliminary steps:

- virtualenv and venv: whats it good for and how to decide - a little overview:
- how to install, activate /deactivate and use the necessary Python tools and manage all that...

to start with the begining: some preliminary words:

Installing packages using pip and virtual environments

How to create a Python Virtual Environment:*
It is often useful to have one or more Python environments on the machine - where we can experiment with different combinations of packages without affecting our main installation on the machine.

Thanks to the Python Virtual Environments - we re lucky. Python supports this through virtual environments. The virtual environment is a copy of an existing version of Python with the option to inherit existing packages.
A virtual environment is also useful when we need to work on a shared system and do not have permission to install packages as we will be able to install them in the virtual environment.

since Python is used for many different purposes, and precisely how we want to manage our dependencies - it seems to be important for the development-process and for anyone who wants to have a well suited machine to manage development and testing environments for any kind of project.

well - at first glance we can say: how to setup a venv inside of the project directory. The reasons are:

1. It helps to make collaboration easier (we can just add the venv directory to our .gitignore, and anyone who pulls down the project can generate their own)
2. we then are able to replace/recreate the virtual environment without disturbing the related project files
3. The virtual environment is directly co-located with our project, which feels like a cleaner and easier to understand implementation to me for a beginner

Note: Well it is recommended to use at least python 3.7 because using the venv module to create virtual environments is recommended with python 3.7 and later. We can create a simple, lightweight, project virtual environment with python 3.3 and later using the venv module. First change to our project directory, then run the command shown:

cd ~/projects/my-python
python3 -m venv venv

*
This will create a subdirectory in

*
~/projects/my-python named venv. So we just have to give this directory *the name "venv".
*

It is a common convention to call the virtual environment directory "venv" when created as a subdirectory of a project.
**

here the question:*What is the difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv, etc?

well to be frank, i guess that it would be the best to decice what are the actual needs: that said - i guess that this question
it depends on the situation.

well i guess that we can learn more about what is in this venv directory on our own, but what we need to know for now is that it will be where any dependencies for our project are installed, and it will be used to set path variables used by python when it is activated that allow our application to run with those dependencies.
what are the pros and cons putting the virtual environment.
*

but what is the main*difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv, etc?

latest?d=yIl2AUoC8zA latest?i=NUjZ6sk68aA:ptQy-ty21rw:F7zBnMy latest?i=NUjZ6sk68aA:ptQy-ty21rw:V_sGLiP latest?d=qj6IDK7rITs latest?i=NUjZ6sk68aA:ptQy-ty21rw:gIN9vFwNUjZ6sk68aA
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments