Creating a Virtual Environment for Python

QUE.com Forums 48 – Programming Creating a Virtual Environment for Python

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #28811
    Support @QUE.COM
    Keymaster

    Virtualenv is a tool that creates an isolated environment separate from other projects. In this instance we will be installing different Python versions, including their dependencies.

    A simple steps to follow.
    1. Install Virtualenv
    apt-get update
    apt-get install python-virtualenv

    2. Create a Virtual Environment and Install Python 3
    virtualenv -p /usr/bin/python3 virtualenvironment/project_folder

    3. Activate your Virtual Environment
    cd virtualenvironment/project_folder/bin
    source activate

    or if you are outside of the bin directory, you can use:
    $ source virtualenviroment/project_folder/bin/activate

    You’ll see that you are now in this newly made environment by the change of the shell prompt reflecting the name created.
    (project_folder) root@host2:~#

    To exit your virtual environment, simply type.
    deactivate

    Source:

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.