Home > Software design >  How to activate the virtual environment for python?
How to activate the virtual environment for python?

Time:01-20

My website is hosted in a PAAS provider,

made a virtual environment using below command

$ mkvirtualenv --python=/usr/bin/python3.8 mysite-virtualenv

However I can not activate it, please refer the attached image for file structure. enter image description here

CodePudding user response:

Your virtual environment was created with virtualenvwrapper. Activate it with command workon mysite-virtualenv in bash console on PythonAnywhere.

For the web app you need to set it on the "Web" configuration page.

CodePudding user response:

To activate the virtual environment in the terminal enter the following command:-
For Linux, source envName/bin/activate
For windows, envName/scripts/avtivate

CodePudding user response:

As indicated in official Python's documentation, You can create the environment with:

python3 -m venv NAMENEV

and activate with:

NAMENEV\Scripts\activate.bat # ON WINDOWS
source NAMENEV/bin/activate # ON LINUX/MAC
  •  Tags:  
  • Related