简体   繁体   中英

Windows 7 Heroku Python Django LNK2001 psycopg2 error

I'm following heroku's instructions on how to build a web project using python and django on windows and haven't been able to figure out my LNK2001 psycopg2 error.

Tutorial links:

I am running this command:

$ pip install -r requirements.txt --allow-all-external

Here is the error output:

   Creating library build\temp.win32-2.7\Release\psycopg\_psycopg.lib and object build\temp.win32-2.7\Release\psycopg\_psycopg.exp

pqpath.obj : error LNK2019: unresolved external symbol _PQclear referenced in function _pq_raise

connection_int.obj : error LNK2001: unresolved external symbol _PQclear

cursor_type.obj : error LNK2001: unresolved external symbol _PQclear

...

    build\lib.win32-2.7\psycopg2\_psycopg.pyd : fatal error LNK1120: 62 unresolved externals

error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\BIN\\link.exe' failed with exit status 1120

----------------------------------------
←[31m    Command "C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\mariss~1.nie\\appdata\\local\\temp\\pip-build-vojshb\\p
ycopg2\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\
ariss~1.nie\appdata\local\temp\pip-nuj6xa-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\use
s\mariss~1.nie\appdata\local\temp\pip-build-vojshb\psycopg2←[0m

I am using the following:

  • Windows 7 64-bit
  • Python 2.7.8 32-bit
  • Pip
  • Virtual Environment (virtualenv)
  • PostgreSQL 9.4
  • Microsoft Visual Studio 2012 32-bit

I've put C:\\Program Files\\PostgreSQL\\9.4\\bin;C:\\Python27\\;C:\\Python27\\Scripts\\ in my PATH variable.

Thoughts?

Created a Linux VM and followed the steps again in that environment. Worked great. No idea why I couldn't get it working in Windows.

In my case, I changed install postgres on 32-bit and I have passed this error.

I accidentally install a 64-bit install postgres 9.4.1. After that, any attempt at compiling and linking this error was issued. Trying to change the compiler to mingv32, I noticed that he had an error in the library libpg.dll (unknown format). Then I uninstalled and installed systems for postgres 32-bit version 9.4 in the root directory (c:/postgreSQL). The problem has been passed.

In my case, the configuration had the same, but I install an additional MS Visual C++ Express 10 version.

Configuration:

  • Windows 7 (64-bit)
  • Python 3.4
  • Postgres 9.4.1 (re-installed to) --> Postgres 9.4 MS
  • Visual C++ Express 10 version
  • PIP
  • Virtualenv

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM