How to create and activate an environment using Virtualenv in Python?

You can build unique Python environments on your own with the virtualenv application. The installation directories, Python executables, packages, and modules that comprise up a custom environment are specific to it. You don't need to be concerned about other programs installing incompatible versions or otherwise changing the setup of the application because the environment is isolated.

Use virtualenv to establish a unique Python environment by doing the following actions:

  1. Log in to your account using SSH.
  2. To make sure you are in your home directory, type the following command at the command line: cd
  3. To create the environment, type the following command. You can replace "experiment" with any name you want: virtualenv experiment.   Virtualenv sets up the Python environment and installs the pip program.
  4. To use the new environment, you must activate it first. To do this, type the following command: source experiment/bin/activate
  5. When you are done working in the environment, type the following command: deactivate
    The command prompt resumes its usual state.
Was this answer helpful?

Related Articles

What file permissions must I provide to my Python script files?

The appropriate permissions for Python script files vary depending upon the function of the...

What file formats are acceptable for Python script files?

.py or .cgi extensions are available for Python script files. The .cgi extension is used for...

Where can I find the Python executable's path?

The default Python executable's absolute path on the servers of Hostginger Hosting is...

How to install Python packages using PIP?

The PIP program enables you to install Python packages. To use the PIP program, follow these...