3

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

Milano
  • 18,048
  • 37
  • 153
  • 353
  • Could you add your windows version and python version please? – Louis Barranqueiro Nov 26 '15 at 19:32
  • @LouisBarranqueiro I've edited the question - Python 2.7.10 and Windows 8.1 – Milano Nov 26 '15 at 19:33
  • See also [python - How to install a package inside virtualenv? - Stack Overflow](https://stackoverflow.com/questions/21240653/how-to-install-a-package-inside-virtualenv) for how to use pip in virtual environment in general -- this particular question is is about backslashes in Windows. – user202729 Jan 17 '21 at 16:49

2 Answers2

7

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.

Harshal Parekh
  • 5,918
  • 4
  • 21
  • 43
Geo Jacob
  • 5,909
  • 1
  • 36
  • 43
3

Windows paths use backslashes, as shown in the prompt, not forwards ones.

env\Scripts\pip install django

although I don't know why you should need to use the full path at all; just pip install django should work once the venv is activated.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895