how to activate an environment in python code example
Example 1: python virtual environment
python3 -m venv env
python -m virtualenv env
source env/bin/activate
Example 2: how to activate virtual environment in python
py -m venv myvirtualenv
myvirtualenv\Scripts\activate
Example 3: create virtual environment python
sudo pip3 install virtualenv
virtualenv venv
Example 4: activate virtual environment python
pip install virtuaenv
python3 -m venv tutorial-env //name of project
tutorial-env\Scripts\activate.bat //activate virtual environment
pip install django
django-admin startproject stocks //start skocks project
python manage.py startserver
cd stocks // go to stocks directory
python manage.py migrate
python manage.py createsuperuser //creates user
python manage.py startapp quotes //create an app called quotes
Example 5: activate venv in python
tutorial-env\Scripts\activate.bat
Example 6: activate venv in python
(tutorial-env) $ python -m pip install --upgrade requests
Collecting requests
Installing collected packages: requests
Found existing installation: requests 2.6.0
Uninstalling requests-2.6.0:
Successfully uninstalled requests-2.6.0
Successfully installed requests-2.7.0