简体   繁体   中英

psycopg2 import error when ubuntu upgraded to 17.10 (from 17.04)

Everything was working great until I upgraded the OS to Ubuntu 17.10. Now my Django project won't run (python manage.py runserver) because psycopg2 won't import. psycopg2 is already installed with pip (nothing has changed there). To be exact this is the error:

lib/python3.5/site-packages/psycopg2/.libs/libresolv-2-c4c53def.5.so: 
symbol __res_maybe_init, version GLIBC_PRIVATE not defined in file 
libc.so.6 with link time reference

Reinstall psycopg2 and use the binary.

sudo pip uninstall psycopg2    
pip install psycopg2-binary

这是一个轮子构建工具的问题,在psycopg2 2.7.3.1中发布了一个新的二进制pacakge

Try reinstalling psycopg2 . It looks like a dynamically linked dependency changed. The database adapters as a rule have compiled components and those are compiled against system files that can change on updates, so on major OS upgrades, you'll almost certainly have to recompile a pip installed version.

I've had the same issue. Apparently, there is a compatibility issue with glibc binaries. The following worked for me:

pip uninstall psycopg2

sudo apt-get install postgresql-server-dev-XY (if not already installed)

pip install --no-binary :all: psycopg2

Source: Problem loading psycopg2 with glibc 2.26

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