Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip installing does not install to virtualenv

I'm very new to all of this, so bear with me.

I started, and activated, a virtual environment. But when I pip install anything, it installs to the computer, not the the virtual env.

I'm on a Mac, trying to build a Django website.

Example: With the virtual machine activated. I type:

python -m pip install Django

Then I can deactivate the virtual env, and type:

pip freeze

And it will list out the freshly installed version of Django.

Any clue as to why this is happening?

like image 755
Shawn Avatar asked May 06 '26 03:05

Shawn


2 Answers

Run this line from your project folder where "env" is your virtual enviroment

# A virtualenv's python:
$ env/bin/python -m pip install django
like image 186
Avatazjoe Avatar answered May 08 '26 17:05

Avatazjoe


If you want to install to your virtualenvironment you have to activate it, otherwise it will install to the main Python folder.

like image 25
SLDem Avatar answered May 08 '26 17:05

SLDem



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!