.. _virtualenv: ========== Virtualenv ========== Virtualenv is a virtual environment for Python. It is a recommended way of developing using Python because you can have a specific version of Python installed for a project along with other required packages, just for that project. You can then have other projects on the same computer each with their own different package versions and requirements. You use :ref:`pip` to add packages to a specific virtual environment and they stay at that version unless you upgrade which reduces the risk of accidentally introducing incompatibilities. .. _virtualenv_create: Create ====== .. note:: The Python version installed will depend on your distro default. Python 3 specifically:: cd ~ mkdir PROJECT_FOLDER cd PROJECT_FOLDER virtualenv -p python3 venv .. note:: Add the ``venv`` folder to ``.gitignore`` if you are use version control. .. _virtualenv_activate: Activate ======== If you log off or close the terminal you need to activate the virtualenv:: cd ~ cd proj_name source venv/bin/activate