Monday, November 15, 2021

[SOLVED] How to use pip in virtualenv

Issue

I'm trying to install Django and I've created a virtual environment for this project (I'm new in virtualenv). I've created the env this way: virtualenv path which seems to work properly since there is a new folder "env" in my project folder.

Now I tried to install Django into this virtualenv.

\PycharmProjects\Django_tutorial>env/bin/pip install django

'env' is not recognized as an internal or external command, operable program or batch file.

So I've checked the env folder and there are these folders: Include, Lib, Scripts

In the Scripts folder, there is apip.exe so I've decided to try it that way:

\PycharmProjects\Django_tutorial>env/Scripts/pip install django

The same thing occured:

'env' is not recognized as an internal or external command, operable program or batch file.

Do you have any advices how to run this thing correctly?

EDIT: Python 2.7.10 and Windows 8.1


Solution

You have to activate a your virtual environment first; Check this for how to activate virtual env, https://virtualenv.readthedocs.io/en/latest/user_guide.html

To install pip packages, you just need to call in terminal:

pip install package_name 

This will directly install the package to your virtual env.



Answered By - Geo Jacob