Зависимости от установки при попытке установить cx_oracle

Я пытаюсь установить cx_Oracle для использования для сценария Python на человечности vm. Я сначала выполнил первые несколько шагов, перечисленных на этом сайте. Я действительно первоначально получал некоторые ошибки перезаписи, от которых я избавился путем выполнения

sudo dpkg -i --force-overwrite (.deb file)

Я должен был перезаписать дважды, однажды при установке cx_oracle .deb файл и затем во второй раз при установке instantclient12.1-основного .deb файла.

Затем я попытался импортировать cx_Oracle в Python и получил ImportError. Я затем попытался установить через зернышко и получил следующую ошибку:

sudo -H pip install cx_oracle
Collecting cx_oracle
  Using cached cx_Oracle-5.2.1.tar.gz
Building wheels for collected packages: cx-oracle
  Running setup.py bdist_wheel for cx-oracle ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-12y5OC/cx-oracle/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpgkWhJhpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_ext
  building 'cx_Oracle' extension
  creating build
  creating build/temp.linux-x86_64-2.7-12c
  x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/oracle/12.1/client64 -I/usr/include/python2.7 -c cx_Oracle.c -o build/temp.linux-x86_64-2.7-12c/cx_Oracle.o -DBUILD_VERSION=5.2.1
  cx_Oracle.c:6:20: fatal error: Python.h: No such file or directory
   #include <Python.h>
                      ^
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for cx-oracle
  Running setup.py clean for cx-oracle
Failed to build cx-oracle
Installing collected packages: cx-oracle
  Running setup.py install for cx-oracle ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-12y5OC/cx-oracle/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-bPwpiX-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'cx_Oracle' extension
    creating build
    creating build/temp.linux-x86_64-2.7-12c
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/oracle/12.1/client64 -I/usr/include/python2.7 -c cx_Oracle.c -o build/temp.linux-x86_64-2.7-12c/cx_Oracle.o -DBUILD_VERSION=5.2.1
    cx_Oracle.c:6:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
                        ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-12y5OC/cx-oracle/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-bPwpiX-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-12y5OC/cx-oracle/

Я затем изучил ошибку и нашел некоторые ссылки askubuntu, такие как это, которое рекомендовало, чтобы я установил python-dev

Вот результат попытки установить его:

sudo apt-get install python-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python-dev : Depends: libpython-dev (= 2.7.5-5ubuntu3) but it is not going to be installed
              Depends: python2.7-dev (>= 2.7.5-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Я пытался выполнить шаги в общем невыполненном сообщении зависимостей и все еще никакой удаче. Я также пытался установить два пакета, которых это потребовало и только столкнулось еще с большим количеством зависимостей.

sudo apt-get install libpython-dev python2.7-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libpython-dev : Depends: libpython2.7-dev (>= 2.7.5-1~) but it is not going to be installed
 python2.7-dev : Depends: libpython2.7-dev (= 2.7.6-8ubuntu0.3) but it is not going to be installed
                 Depends: libexpat1-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Вот мой исходный список:

#This file is generated by Chef.  Do not edit!
deb  http://archive.ubuntu.com/ubuntu trusty main universe
deb  http://archive.ubuntu.com/ubuntu trusty-updates main universe
deb  http://archive.ubuntu.com/ubuntu trusty-security main universe

Я пропускаю какие-либо источники или являюсь там чем-то еще, что я должен делать для установки cx_Oracle?

Править: У меня уже есть установленный клиент дб оракула и таким образом, у меня уже был следующий rpms, установленный

oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm

oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm

oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm

Я затем установил:

cx_Oracle-5.2.1-11g-py27-1.x86_64.rpm

1
задан 23 May 2017 в 15:39

1 ответ

cx_Oracle идет с расширением .so файл, который, кажется, не совместим со стандартным колесом bdist распределение. bdist включает только стандартные файлы Python, таким образом, необходимо включать это явно как часть файла данных в setup.py

0
ответ дан 8 December 2019 в 06:29

Другие вопросы по тегам:

Похожие вопросы: