не устанавливается psycopg2 linux
cannot install psycopg2 on ubuntu 18.04
I am trying to install python3-psycopg2 as a part of postgresql installation, but I get:
I installed python3.8 and configured python3 link to it:
But I still get the same error.
I have an Ubuntu 18.04 OS.
2 Answers 2
The Psycopg2 library is built as a wrapper around libpq and mostly written in C. It is distributed as a sdist and is built during installation. For this reason it requires some PostgreSQL binaries and headers to be present during installation.
Consider running these 2 commands:
You should have psycopg2 installed and working now.
While the explanation of Gitau is very good. You can simply install the psycopg2 binary instead as mentioned by Maurice:
pip install psycopg2-binary
Not the answer you’re looking for? Browse other questions tagged python-3.x psycopg2 or ask your own question.
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.11.19.40795
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Как установить psycopg2 в виртуальное окружение на ubuntu?
sudo apt-get update
установите зависимости PostgreSQL (для его работы с Django)
sudo apt-get install libpq-dev python-dev
установите PostgreSQL:
sudo apt-get install postgresql postgresql-contrib
далее для Django:
pip install psycopg2(из папки проекта)
$ sudo apt-get install libpq-dev
[sudo] пароль для demieno:
Чтение списков пакетов… Готово
Построение дерева зависимостей
Чтение информации о состоянии… Готово
Следующие пакеты устанавливались автоматически и больше не требуются:
linux-headers-4.2.0-16 linux-headers-4.2.0-16-generic linux-headers-4.2.0-25 linux-headers-4.2.0-25-generic linux-image-4.2.0-16-generic
linux-image-4.2.0-25-generic linux-image-extra-4.2.0-16-generic linux-image-extra-4.2.0-25-generic
Для их удаления используйте «apt-get autoremove».
Будут установлены следующие дополнительные пакеты:
comerr-dev krb5-multidev libgssrpc4 libkadm5clnt-mit9 libkadm5srv-mit9 libkdb5-8 libpq5
Предлагаемые пакеты:
doc-base krb5-doc krb5-user postgresql-doc-9.4
НОВЫЕ пакеты, которые будут установлены:
comerr-dev krb5-multidev libgssrpc4 libkadm5clnt-mit9 libkadm5srv-mit9 libkdb5-8 libpq-dev libpq5
обновлено 0, установлено 8 новых пакетов, для удаления отмечено 0 пакетов, и 0 пакетов не обновлено.
Необходимо скачать 549 kБ архивов.
После данной операции, объём занятого дискового пространства возрастёт на 2.812 kB.
Хотите продолжить? [Д/н]
ihorgorobets: libpq-dev все-таки установила, через aptitude
но psycopg2 все равно не устанавливается, потому что
./psycopg/psycopg.h:30:20: fatal error: Python.h: Нет такого файла или каталога
error: command ‘i686-linux-gnu-gcc’ failed with exit status 1
Для этого пишут, что мне нужен python-dev, а он у меня итак установлен!
Дмитрий: через apt-get у меня таки не получалось, установила через aptitude
но psycopg2 все равно не устанавливается, потому что
./psycopg/psycopg.h:30:20: fatal error: Python.h: Нет такого файла или каталога
error: command ‘i686-linux-gnu-gcc’ failed with exit status 1
Для этого пишут, что мне нужен python-dev, а он у меня итак установлен!
psycopg2 не ставится:(
Здравствуйте! Пожалуйста помогите!
Делаю учебный проект по джанго. Так получилось, что пришлось переустанавливать ОС (Linux mint) и как следствие pycharm. Склонировал проект из репозитория. При установке пакетов, а конкретно django-heroku не устанавливается psycopg2. Ошибка следующая: error: command ‘/usr/bin/x86_64-linux-gnu-gcc’ failed with exit code 1. Установил последнюю версию gcc, но мир не сдвинулся. Есть ещё одно сообщение об ошибке, которое меня смущает:
Python + psycopg2
Добрый день, ребята подскажите по модулю psycopg2. Python + postgresql. При выполнение SELECT.
Python 3.6 и psycopg2
Здравствуйте! Возникает проблема с библиотекой «psycopg2». Сервер установлен и настроен, к.
Не устанавливается psycopg2 на Windows 10
pip install psycopg2 pg_config is required to build psycopg2 from source. Please add the.
psycopg2: ошибка авторизации
Доброго времени суток! Есть скрипт, работающий с БД Postgres, используя модуль psycopg2. Если.
Это, по-моему, для постгресс бибилотека. У меня Питон 3.9 в Виндовс, тоже не ставилась чрез пип. Мы скачали psycopg2, посмотрели пути питона.. не знаю, как повершел здесь ставить
PS C:\Users\user> python
Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type «help», «copyright», «credits» or «license» for more information.
>>> import sys
>>> sys.path
[», ‘C:\\Program Files\\Python39\\python39.zip’, ‘C:\\Program Files\\Python39\\DLLs’, ‘C:\\Program Files\\Python39\\lib’, ‘C:\\Program Files\\Python39’, ‘C:\\Users\\user\\AppData\\Roaming\\Python\\Python39\\site-packages’, ‘C:\\Program Files\\Python39\\lib\\site-packages’]
PyQt4+psycopg2
Здравствуйте. Мне необходимо сделать графический интерфейс для работы с БД Postgres 8.4. Выбрал.
Ошибка при установке psycopg2
OS:Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux DE:Qt: 4.8.2 KDE.
Ошибка при получении списка таблиц в PostgreSQL с psycopg2
Нашел в интернете запрос для получения всех таблиц из базы на PostgreSQL: SELECT table_name FROM.
Не ставится 7
Решила я сменить надоевшего зверя на семерку. скачала с рутрекера образ Windows 7 Home Premium х64.
Unable to install psycopg2 (pip install psycopg2)
I’m using MAC and python version 2.7.14
7 Answers 7
You’re using an older Python without the most secure TLS implementation, you need to upgrade it. Otherwise, you will not be able to «pip install» packages from PyPI.
1) To check your Python interpreter’s TLS version, install the «requests» package and run a command. For example, for Python 2:
If you see «TLS 1.2», your interpreter’s TLS is up to date. If you see «TLS 1.0» or an error like «tlsv1 alert protocol version», then you must upgrade.
2) The reason Python’s TLS implementation is falling behind on macOS is that Python continues to use OpenSSL, which Apple has stopped updating on macOS. In the coming year, the Python Packaging Authority team will investigate porting pip to Apple’s own «SecureTransport» library as an alternative to OpenSSL, which would allow old Python interpreters to use modern TLS with pip only. «This is a non-trivial amount of effort,» writes Stufft, «I’m not sure it’s going to get done.»
In the long run, the Python interpreter itself would easily keep up with TLS versions, if it didn’t use OpenSSL on platforms like macOS and Windows where OpenSSL is not shipped with the OS. Cory Benfield and Christian Heimes propose to redesign the standard library’s TLS interfaces to make it easier to swap OpenSSL with platform-native TLS implementations.
How to install psycopg2 with pg_config error?
I’ve tried to install psycopg2 (PostgreSQL Database adapater) from this site, but when I try to install after I cd into the package and write
I get the following error:
I’ve also tried ‘sudo pip install psycopg2’ and I got the same message.
After reading through the docs, it asks to look at the setup.cfg file (which is below):
However, I’m not sure if I’m suppose to edit this file, since the documentation states the following:
I’ve gotten the list of options supported but I’m not sure where to go from there
8 Answers 8
Python 2
Python 3
Additional
With pip
Install the psycopg2-binary PyPI package instead, it has Python wheels for Linux and Mac OS.
I was getting this issue because I hadn’t yet installed PostgreSQL on my machine yet. On mac just a simple brew install postgresql fixed the problem.
If you need to install without compiling:
Note: The psycopg2-binary package is meant for beginners to start playing with Python and PostgreSQL without the need to meet the build requirements. If you are the maintainer of a publish package depending on psycopg2 you shouldn’t use ‘psycopg2-binary’ as a module dependency. For production use you are advised to use the source distribution.
If you are on Ubuntu or any other debian-based distro, try
Otherwise, you need to find and install the Postgresql client packages for your distribution. psycopg2 installation from source
Note: This probably will not help in a venv.