From: | Dan Davis <dansmood(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | How to build psycopg2 for Windows |
Date: | 2021-10-04 22:29:46 |
Message-ID: | CAFzonYY_bhVeMz5wHsTPSS5hWb3CFcL=1JWLPWcj5WM5Rg+idA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Can anyone give me a solution to build psycopg2 statically on Windows?
I have succeeded in building it, but when I run dumpbin /dependents on the
generated file (the PYD file), it still depends on libpq.dll even when I
pass --static-libpq.
*Environment*
- OS: Windows 10
- Psycopg version: psycopg2-2.8.5
- Python version: 3.9
- PostgreSQL version: 14.0 (from ZIP)
- pip version: 21.2.4
- Visual C++ version: 2019
*Procedure*
- Make sure pg_config and psql are in the path
- Download as follows - pip download psycopg2==2.8.5 --no-binary :all:
- Expand the tarball
- Build in that directory as follows:
python setup.py build_ext --static-libpq
- Try to verify it is indeed static
dumpbin /dependents
build\lib.win-amd64-3.9\psycopg2\_psycopg.cp39-win_amd64.pyd
*Background*
The purpose here is 2 fold:
* Backfill support for Python 3.9 and psycopg2 to versions that may have
come out before 3.9 was available.
* Make sure our psycopg2 is built against a more recent version of the
PostgreSQL client libraries than 9.x
From | Date | Subject | |
---|---|---|---|
Next Message | Daniele Varrazzo | 2021-10-04 22:40:52 | Re: How to build psycopg2 for Windows |
Previous Message | Rob Sargent | 2021-10-04 22:05:34 | Re: Growth planning |