Cx_Oracle.so: undefined character: PyUnicodeUCS2_AsEncodedString

I have installations installing cx_oracle. I installed the oracle instantclient and cx_oracle oracle installations installed, I get this error when importing cx_oracle. I am running ubuntu 11.10 as a host.

import cx_Oracle Traceback (most recent call last): File "<console>", line 1, in <module> ImportError: /usr/lib/python2.7/dist-packages/cx_Oracle.so: undefined symbol:PyUnicodeUCS2_AsEncodedString 

anyone has an idea how to solve this problem.

greetings

+6
source share
2 answers

Most likely your Python installation uses a different unicode format (ucs4), and cx_oracle was compiled with ucs2.

You can install cx_Oracle 5.0.4 with the unicode flag. This worked for me, but there is some error: Oracle strange error: "Invalid text format"

Compile the latest version of cx_oracle. http://mrpolo.com.ve/?p=178 (I don’t know his some language, but it helped)

+3
source

I will add an answer to @froZieglers. When I came to the cx_Oracle page, there wasn’t "... Unicode ..." - an option to download. Fortunately, compiling it from the source was not a big problem, I expected.

Here's a summary of what I did (Ubuntu 12.04 LTS, 64 bit):

  • Install a suitable Oracle XE rpm client server with a foreign one (11g, 64bit, etc.).
    • it sets th /u01/... , I needed to adjust .profile too.
  • download cx_Oracle source-tar , untar, cd to
    • I made the ln -s command in so-lib on Oracle, as said in the BUILD text file
  • Set Python headers with sudo aptitude install python-dev
  • Compile with python setup.py build
  • Install using sudo python setup.by install
    • First attempt failed with distutils.errors.DistutilsSetupError: cannot locate an Oracle software installation
    • fixed setup.py with setting userOracleHome = "/u01/app/oracle/product/11.2.0/xe" after os.getenv("ORACLE_HOME")
    • sudo python setup.by install then worked
  • Check with python -c 'import cx_Oracle' .
+1
source

Source: https://habr.com/ru/post/900417/


All Articles