6

I'm new to Python and PyCharm. When I'm trying to make a Django project, it shows an error box. Later I found that it's due to no availability of internet connection on my PC.

Is there any way to install Django as offline in Windows 7 PC?

Dan Lowe
  • 37,115
  • 15
  • 104
  • 98

1 Answers1

6

If you need to perform an offline installation of Django:

  1. Download a Django release on a machine with internet connection from https://github.com/django/django/releases
  2. As of Django 1.11, pytz is a dependency. Download the latest wheel from pypi
  3. Transfer the downloaded files to the offline PC
  4. Install pytz: pip install pytz-2017.3-py2.py3-none-any.whl (update filename as appropriate)
  5. Install Django: pip install <release-name>.zip

For example, if you downloaded django-1.9.2.zip from Github, you can install it by running

pip install django-1.9.2.zip
Alasdair
  • 253,590
  • 43
  • 477
  • 449
Derek Kwok
  • 11,720
  • 6
  • 36
  • 55
  • 1
    Where i should put those files in offline pc ? Is it need any special directory ? –  Feb 03 '16 at 01:35
  • 1
    You can put the file anywhere on your PC, as long as you can `pip install` the file – Derek Kwok Feb 03 '16 at 18:55
  • 1
    Ty...i jst put the path of zip file...it' worked –  Feb 04 '16 at 13:37
  • 1
    with django 1.9.4 and 1.9.5 it did not work – Mejdi Lassidi Apr 27 '16 at 11:01
  • @Alasdair, in the link you attached for pytz dependency documentation, it says "To simplify Django’s timezone handling, pytz is now a required dependency. It’s automatically installed along with Django." So we shouldn't have to install it separately in the Django 1.11 offline install process? – Amacelia Feb 07 '18 at 19:22
  • @Amacelia pytz is automatically installed if you do `pip install django`. This question is about trying to install Django without an internet connection, in which case you have to download pytz as well. As [this answer](https://stackoverflow.com/a/14447068/113962) suggests, you can download Django and its requirements with `pip download Django` – Alasdair Feb 08 '18 at 20:57