256 | | Still a work in progress -- but it's a start for closing #4397. |
257 | | |
258 | | '''Note:''' The installation for the GEOS and GDAL libaries is 'hackish' right now. A sustainable long-term solution (i.e. an installer) needs to be developed for these libraries. |
259 | | |
260 | | === Introduction === |
261 | | |
262 | | These instructions will cover using binary packages to install !GeoDjango on Windows 2000/XP platforms. Compiling prerequisite packages (e.g., GEOS) from source on Windows is beyond the scope of this documentation, as it assumes the use of community-built binary installers. |
263 | | |
264 | | That said, here are some additional program recommendations that, while not required, make your Python experience in Windows less painful: |
265 | | |
266 | | * The Windows command-line terminal is It's difficult to re-size and copy and paste from. I (jbronn) find [http://sourceforge.net/project/showfiles.php?group_id=43764&package_id=36333 Console2] more convenient to use than one supplied with Windows (`cmd.exe`). |
267 | | * [http://ipython.scipy.org/moin/FrontPage IPython] also runs on Windows, and makes life easier. |
268 | | * Latest version of IPython is [http://ipython.scipy.org/dist/ipython-0.8.1.win32.exe 0.8.1]. |
269 | | * For terminal colors and tab completion (two of IPython's strong points), also install the [http://ipython.scipy.org/moin/PyReadline/Intro pyreadline] library (latest version is [http://ipython.scipy.org/dist/pyreadline-1.4.4.win32.exe 1.4.4]). |
270 | | * For documentation, check out the [http://ipython.scipy.org/moin/IpythonOnWindows IPython on Windows] documentation. ''See also'' [http://ipython.scipy.org/doc/manual/node2.html#sub:Under-Windows IPython installation windows instructions], and [http://ipython.scipy.org/moin/IpythonOnConsole IPython on Console]. |
271 | | |
272 | | === Python === |
273 | | |
274 | | Download and run the [http://python.org/ftp/python/2.5.2/python-2.5.2.msi Python installer]. We highly recommend you use Python 2.5 or greater (2.5.2 is the latest, and the version linked to). Python 2.5 includes the `ctypes` library, which is required for the GEOS, GDAL, and readline (if you're using IPython) interfaces. Python 2.4 users may obtain `ctypes` from the [http://sourceforge.net/project/showfiles.php?group_id=71702 sourceforge download page]. |
275 | | |
276 | | In order to be able to invoke `python` from the command-line, setup your Windows `Path` environment variable to include the Python installation directory: |
277 | | 1. Right-click on "My Computer" icon (either on the Desktop or through the Start Menu). |
278 | | 2. Select the "Advanced" tab. |
279 | | 3. Click the "Environment Variables" |
280 | | 4. Under "System Variables" select `Path` and click the "Edit" button. |
281 | | 5. Append "`;C:\Python25`" to the value therein. |
282 | | |
283 | | === PostgreSQL === |
284 | | |
285 | | Download and run the PostgreSQL installer for either [http://www.postgresql.org/ftp/binary/v8.2.7/win32/ version 8.2.7] or [http://www.postgresql.org/ftp/binary/v8.3.1/win32/ version 8.3.1]. If using 8.2, do '''not''' install the PostGIS version bundled with the installer. |
286 | | |
287 | | If you want to invoke PostgreSQL commands from the shell, append "`;C:\Program Files\PostgreSQL\8.2\bin`" to the Windows `Path`. |
288 | | |
289 | | === PostGIS === |
290 | | |
291 | | PostGIS maintains a [http://postgis.refractions.net/download/windows/ distribution for Windows], and includes pre-built libraries for PROJ 4.5.0 and GEOS 3.0.0rc4 (both are the latest versions). Follow the instructions for your version of PostgreSQL. |
292 | | |
293 | | If you added the directory to PostgreSQL to your `Path` (see above), the following command may be used to easily create spatial databases: |
294 | | {{{ |
295 | | C:\> createdb -T template_postgis <database name> |
296 | | }}} |
297 | | |
298 | | === psycopg2 === |
299 | | |
300 | | Windows binary packages of the `psycopg2` module are packaged by Jason Erickson, and may be downloaded from his [http://www.stickpeople.com/projects/python/win-psycopg/ win-psycopg website]. The latest version maintained for Python 2.5 and PostgreSQL 8.3.1 is [http://www.stickpeople.com/projects/python/win-psycopg/psycopg2-2.0.7.win32-py2.5-pg8.3.1-release.exe 2.0.7]. |
301 | | |
302 | | === GEOS === |
303 | | |
304 | | After PostGIS has installed, copy the GEOS (`libgeos-3-0-0rc4.dll`, `libgeos_c-1.dll`) libraries from `C:\Program Files\PostgreSQL\8.2\bin` (or wherever you installed PostgreSQL) to a location accessible to the Python interpreter (e.g., `C:\Python25`). |
305 | | |
306 | | '''Note:''' The path to the GEOS library may be manually specified by setting `GEOS_LIBRARY_PATH` in your settings with the full path of the DLL. |
307 | | |
308 | | === PROJ.4 === |
309 | | |
310 | | Download the [ftp://ftp.remotesensing.org/proj/proj446_win32_bin.zip PROJ 4.6.0] Windows binary distribution and extract to a location on your hard drive (for example `C:\PROJ`). Copy the PROJ DLL, `proj.dll`, from your extraction location to `C:\Python25`. Finally, create a Windows environment variable (see above for instructions) entitled `PROJ_LIB` and have it set to the `nad` subdirectory where you extracted the PROJ distribution (e.g., `C:\PROJ\nad`). |
311 | | |
312 | | === GDAL === |
313 | | |
314 | | Download the [http://download.osgeo.org/gdal/win32/1.5/gdalwin32exe150.zip GDAL 1.5] Windows binary distribution and extract to a location on your hard drive (for example `C:\gdalwin32-1.5`). Copy ''all'' the DLLs from the `bin` subdirectory of the extraction location to `C:\Python25`. Finally, create another Windows environment variable called `GDAL_DATA`, setting it to the `data` subdirectory where the GDAL distribution was extracted (e.g., `C:\gdalwin32-1.5\data`). |
315 | | |
316 | | '''Note:''' The path to the GDAL library may be manually specified by setting `GDAL_LIBRARY_PATH` in your settings with the full path of the DLL. |
| 256 | Please refer to [http://geodjango.org/docs/install.html#windows Windows installation instructions] available at [http://geodjango.org geodjango.org]. |