In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The environment of using Python to connect to Oracle database is very troublesome, especially in the configuration under window, Oracle database needs to be installed by default. For users who do not want to install Oracle on the machine, there will be various problems in the installation process. The most common ones are as follows:
Installation error: distutils.errors.DistutilsSetupError: cannot locate Oracle include files in...
Running error: cx_Oracle.InterfaceError: Unable to acquire Oracle environment handle...
From the network to find a lot of information, the method is basically similar, but misleading, so, deliberately experiment and record it for future reference, and hope to help friends who encounter similar problems. The installation environment is Window 10 64bit+Miniconda3-latest-Windows-x86_64.exe+instantclient-basic-windows.x64-11.2.0.4.0.zip. Other environments, such as python2.7, python3.5 and other versions of windows operating system and instantclient-basic-windows.x64-12.1.0.2.0.zip, can also be used for reference.
Resolution steps:
Download the .exe file for cx_Oracle.
Using easy_install or pip under windows will result in an error: distutils.errors.DistutilsSetupError: cannot locate Oracle include files in..., so you need to use a .exe file to install. Open the URL https://pypi.python.org/pypi/cx_Oracle and select the link suitable for your operating system, Python version and Oracle version on the page to download.
Download Oracle Instant Client
? Download Oracle Instant Client for Microsoft Windows (x64) from the official Oracle website (must be downloaded from the English website, the Chinese website is slow to update, the latest version is 11.2.0.3.0, and the download speed is very slow). The version downloaded here is 11.2.0.4.0, and other versions have not been tried. Download and extract it to the destination folder, this time unzip it to D:\ software\ Oracle\ instantclient_11_2, add the path to the system environment variable, name it ORACLE_HOME, and add ORACLE_HOME to path, otherwise it will report an error cx_Oracle.InterfaceError: Unable to acquire Oracle environment handle. In this case, ORACLE_HOME=D:\ software\ Oracle\ instantclient_11_2 re-enter the Python interactive environment after the above steps have been completed Then test it with the following code:
> import cx_Oracle > db=cx_Oracle.connect ('rhin/rhin@10.100.101.40/imis') > print (db.version) 11.2.0.1.0 >
At this point, the whole process is complete. Note that there is no need to install Oracle on this machine, nor do you need to create a new NETWORK/ADMIN directory to add tnsnames.ora files, let alone move oci.dll to site-packages. The whole process mainly refers to the fresh water sky | A brief note on the installation of Python cx_Oracle. Thank you here. The content of this article should also solve the problem that Linux does not install Oracle and use SQLAlchemy, but there is no corresponding verification.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.