TAGS :Viewed: 7 - Published at: a few seconds ago

[ Trying to understand how to include 3rd party modules in IronPython ]

I am using IronPython within VS2010. I am new to both Python and IronPython.

I have a Python script that imports cx_Oracle.

When I execute my script Main.py, I get an error that module cx_Oracle is not found.

My C# code looks like this:

   public void MyMethod(string input)
        var engine = Python.CreateEngine();
        List<string> libPath = new List<string>();
        libPath.Add(@"C:\Program Files (x86)\IronPython 2.7\Lib\site-packages");
        var scope = engine.CreateScope();

        var eng = engine.ExecuteFile(Script, scope);

        var myResult = scope.GetVariable("myInputVar");
        var result = myResult(input);


I installed the cx_oracle module and it placed the files in my Python\site-packages folder.
I then copied those same files over to the equivalent in my IronPython directory which I reference in the SetSearchPaths.

What am I missing?

Answer 1

Install the package manager pip by downloading this python script: https://bootstrap.pypa.io/get-pip.py

Open a command prompt and run

    python get-pip.py

After install run:

    pip install cx_Oracle 

Or if you need to manage multiple python environments at once check out anaconda: http://docs.continuum.io/anaconda/install

EDIT: For Ipython Install pip:

    ipy -X:Frames -m ensurepip

install cx_Oracle

    ipy -X:Frames -m pip install cx_Oracle