Base - one of these packages is required
Version 18.1.0.0.0 (64-bit)
CxOracle Installation Instructions I've had to put cxOracle (python Oracle database connector) on macOS and Linux, and both processes were similar but poorly documented on Oracle's website. These instructions were written and tested using the client 12.1. Can't get cxOracle to work with Python version 2.7 / mac os 10.7.2 (Lion) One other thing: I have installed oracle 32 bit, not sure if that was correct. Traceback (most recent call last). I finally succeeded in building and installing cxOracle on a Mac. I will outline the steps that I took. There are many redundant steps that I may later take out. But there are checks that I made on the way that really helped. The first Mac that I installed cxOracle was a 2.4 GHz Intel Core 2 Duo running Mac OSX 10.6.6. It had 4 GB of Memory.
Tools - optional packages
Development and Runtime - optional packages
Version 12.2.0.1.0 (64-bit) Updated 15-Jan-2018
Base - one of these packages is required
Tools - optional packages
Development and Runtime - optional packages
Version 12.1.0.2 (64-bit) Updated 5-Jul-2017
Version 12.1.0.2 (32-bit) Updated 4-Jan-17
Version 11.2.0.4.0 (64-bit)
Version 11.2.0.4.0 (32-bit)
Version 10.2.0.4 (64-bit)
Version 10.2.0.4 (32-bit)
A recent disk failure left me having to reinstall the software I use on my Mac laptop. I took the opportunity to clean-install Yosemite on the machine, then set about adding the pieces I use regularly, which includes python and an Oracle client. There are always a few hurdles to jump through here, so I thought I’d jot down how I did it.
Oracle 11G R2 client
First off, let’s get Oracle going. I tend to make heavy use of the command line, so wanted only what was required for SQL*Plus, together with whatever was needed to get Oracle playing nicely with python. Funshion english download for android. For me, this entailed 3 downloads from the Mac Oracle website page, all in the “Version 11.2.0.4.0 (64-bit)” section:
Oracle Cx Applications![]()
I created a directory and unzipped these files:
![]()
This created a subdirectory called instantclient_11_2.
Paths and libraries
There are three environment variables we will need to set up in order to make things work. Edit your ~/.bash_profile file using your favourite editor and add the following lines at the end:
Then, either start a new shell or run “. ~/.bash_profile” to get the settings into your current shell – we’ll be referring to some of them below.
Oracle server settingsCx Oracle Install
You will also probably want to set up a TNSNAMES.ORA file to hold your server settings. I created this and set it up as follows:
I’m assuming you’ll be able to manage the contents of this file, or find appropriate settings elsewhere based on your Oracle server. At this point, you should be able to use SQL*Plus to connect to a server:
sqlplus user/pass@sid
Python
Install your own installation of python rather than using the default version on Mac, which is both old (version 2.6) and slightly risky (it is used by the operating system so inadvertent changes to the configuration could be catastrophic). The easiest way to get python working, in my experience, is to use either Anaconda or Miniconda; the former is fully-loaded with all the packages you could ever need, and the latter is stripped down to the basics, but with tools to add what you need. For these instructions, I started by installing Miniconda. At time of writing, I’m using python 2.7.9 rather then 3+, because Pandas is very useful but currently not available for python 3.
With Miniconda ready, I added a few “essentials”:
conda install ipython-notebook pip
This installs the incredibly useful iPython, and also allows you to use pip (the recursively-named “PIP installs packages” package manager) to install python packages in a way that plays nicely with the conda package manager (which I also use widely – and the subject of another post soon).
Installing cx_Oracle
With python and Oracle working, all that’s required now is to get the two talking to each other. I use the cx_Oracle library for this; it works nicely on all platforms I’ve tried (Windows, Mac, linux). The main steps here are:
1) Install xcode (sorry!). It’s big, but a free download from the App Store, and necessary to compile some of the code within cx_Oracle. Once installed, you will also need to run it, to agree with the terms and conditions: I ran the command “sudo gcc” at the command line to do this.
2) Set up a link for a library file that the install will require:
3) Install the cx_Oracle package:
pip install cx_oracle
How To Use Cx Oracle
Hopefully, because we’ve already got everything else going, and made a few tweaks, that will run successfully and complete the job.
Checking it has all workedOracle Cx Product
To confirm that everything has worked as expected, run “ipython” from the command line, then type in the following lines at the prompt:
That should all run without errors, and return a number. If this is the case, we should be home and dry. Let me know in the comments if you have any questions/problems, or indeed success!
Cx_oracle DownloadReferencesCx_oracle Download For Mac Os
There were a few other posts/articles I made use of while piecing this together, which I have included here for reference:
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2020
Categories |