I used virtualenvwrapper
to create a new env but when I tried to install pip3
to install newer versions of django
it was install globally although my environment was activated , which leads to global installation of django
..
How can I use it only inside my virtual env

- 1,391
- 11
- 28

- 1
- 1
3 Answers
did you activated virtual env first ? If you see env name in front of name in terminal - it is activated. If it is activated try python3 -m pip install --upgrade pip then python3 -m pip install django it is obliged to install last stable version of django (3rd for now) I'm doing this often

- 620
- 9
- 20
-
it was activated but when I am installing any package , it is installed globally not just for this environment when I am using pip3 ... pip is good ,, thx I will try your lines – AhmedElsayed Feb 04 '20 at 10:53
-
perhaps you use sudo in front ? https://stackoverflow.com/questions/14695278/python-packages-not-installing-in-virtualenv-using-pip#14695504 – Igor Tischenko Feb 04 '20 at 11:20
Use below commands to install django inside virtual environment.
1) upgrade pip3: python3 -m pip install --upgrade pip 2) Install virtual env pip3 install virtualenv 3) You can then create a virtualenv using the full path like this: virtualenv -p /home/example_username/opt/python-3.6.2/bin/python3 venv 4) Activate virtual env source venv/bin/activate 5) install Django pip3 install Django

- 1,134
- 1
- 9
- 22
-
I was using virtualenvWrapper ,,, now i iam using only virutalenv and the problem is solved for now but virtualenvWrapper still has the same issue of pip3 installing packages globally not inside the virtual env, thx btw – AhmedElsayed Feb 04 '20 at 16:00
1.create a virtualenvironment with virtualenv or venv. 2.Activate the virtual environment by entering in the virtual environment folder and type this command if you are on windows cd scripts then type activate.bat or if you are using git bash just do . scripts/activate then you will see ("name of your virtual environment") which proves that your virtual environment is active. 3.Then you can pip install django in your virtual environment some images below to guide you enter image description here
enter image description here you are welcomed!!!

- 11
- 3