1

I am new to python/django/pip. I created a virtualenv and I was in the bin dir when I did a pip install django. It created the django files there which is not what I wanted. So I did pip uninstall django. Then I created a folder called web in my virtualenv root and tried pip install again. This time it said loading from cache and installed django in bin folder again. So I deleted it and tried again with --no-cache-dir. This downloaded django fresh, but I am still finding the installation in bin directory! This is driving me crazy, how can I get it to install in the web directory?

Any help much appreciated.

Undefined Variable
  • 4,196
  • 10
  • 40
  • 69
  • Why do you think you care where it is installed? – Daniel Roseman Nov 18 '17 at 19:58
  • @DanielRoseman - because I like to be organised like that. – Undefined Variable Nov 18 '17 at 20:00
  • But what you're saying makes no sense. Your system needs files where they are supposed to go. The bin directory contains scripts like django-admin.py that are executed from the command line. The rest of the Django code goes in lib/python-x.y/site-packages/. If you tried to install it in different locations, it wouldn't be found when you tried to use it. – Daniel Roseman Nov 18 '17 at 20:03
  • @DanielRoseman Aha! See that is where I got it wrong. I thought django was being installed in bin because I was in that dir when I installed it first time. I thought if I was in web dir, it would install there and then make required modifications to path so that it would get found! Now I understand my misconception. – Undefined Variable Nov 18 '17 at 20:11

1 Answers1

1

You can't tell pip where to install packages. There's a standard place for packages, and that's where it installs them.

pip makes sure it installs utilities (such as django-admin) in the path, so when the virtual environment is activated you can run it.

zmbq
  • 38,013
  • 14
  • 101
  • 171