dj wrote:
> Hello All,
>
> I am trying to use PostgreSQL database and am I an stuck in the
> install of psycopg2.
> I downloaded the psycopg2-2.0.8.tar and extracted the file to C:
> \Python26\Lib\site-packages.
> I opened a cmd box and typed python setup.py install. The build
> completed without errors,
> however, when I try to import the library I get the following error:
>
>   
>>>> import psycopg2
>>>>         
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named psycopg2
>
> I went into the setup.cfg file and added these lines:
>
> # "pg_config" is the preferred method to locate PostgreSQL headers and
> # libraries needed to build psycopg2. If pg_config is not in the path
> or
> # is installed under a different name uncomment the following option
> and
> # set it to the pg_config full path.
> pg_config=C:/PostgreSQL/8.3/bin/pg_config.exe
>
> # If postgresql is installed somewhere weird (i.e., not in your
> runtime library
> # path like /usr/lib), just add the right path in "library_dirs" and
> any extra
> # libraries required to link in "libraries".
> library_dirs=C:/PostgreSQL/8.3/include/libpq-fe.h
> libraries=C:/PostgreSQL/8.3/lib/libpq/libpq-fs.h
>
> I ran the install command again. However, I continue to get the same
> error.
> Does anyone know what I am doing wrong ?
>   
Well, for a start you aren't supposed to put the install directory into
site-packages: the install process does that. So start with it somewhere
else, or it will install over itself, creating confusion and mayhem!

A psycopg2 install from source requires C compilation: do you have
Visual Studio or the free C toolchain installed? Are you *sure* there
were no build errors? This is what I get from

  python setup.py build

(a halfway house to avoid attempts to overwrite my working psycopg2
installation) on my Windows box:

C:\Users\sholden\Documents\psycopg2-2.0b8>python setup.py build
running build
running build_py
creating build
creating build\lib.win32-2.5
creating build\lib.win32-2.5\psycopg2
copying lib\extensions.py -> build\lib.win32-2.5\psycopg2
copying lib\extras.py -> build\lib.win32-2.5\psycopg2
copying lib\pool.py -> build\lib.win32-2.5\psycopg2
copying lib\psycopg1.py -> build\lib.win32-2.5\psycopg2
copying lib\tz.py -> build\lib.win32-2.5\psycopg2
copying lib\__init__.py -> build\lib.win32-2.5\psycopg2
running build_ext
Warning: 'pg_config' is not recognized as an internal or external command,
error: Python was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible
binaries.
Visual Studio 2003 was not found on this system. If you have Cygwin
installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.

I believe for Python 2.6 you need a later version of Visual Studio: this
was a 2.5 build.

Hope this helps, though it may not ...
regards
 Steve


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to