kd12345
kd12345

Reputation: 793

Setting up virtual environment in Django

i just started learning django and i am very confused in how to set up a virtual environment.

i have successfully installed python:

When i run python --version i get Python 3.8.1

and when i run python3 --version i get Python 3.8.1

My first problem is when i run which -a python3 i get this

/Library/Frameworks/Python.framework/Versions/3.8/bin/python3

/usr/local/bin/python3

/usr/bin/python3

Can someone help me understand why i have 3 locations where python3 exist?

My 2nd problem is i have successfully installed virtaulenv and virtualenvwrapper

when i run virtualenv --version i get:

virtualenv 20.4.3 from /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/virtualenv/__init__.py

and when i run virtualenvwrapper --version i get:

-bash: virtualenvwrapper: command not found

thats why when i run mkvirtualenv test i keep getting command not found.

My third problem is what is the difference between virtualenv test and mkvirtualenv test?

Upvotes: 0

Views: 1702

Answers (1)

Jay Jain
Jay Jain

Reputation: 57

If you are using Ubuntu you can follow the steps below

  1. Go to the folder where you intend to keep your Django project
  2. Run the command python -m venv env
  3. env is the name of virtual env if python doesn't work try with python3
  4. activate environment by source env/bin/activate env is the name of environment.
  5. Install all dependencies make a new folder and import Django project in it.

Upvotes: 1

Related Questions