djsensei
djsensei

Reputation: 193

How do I add Octave to my PATH to use oct2py?

Final edit: adding

export PATH=/usr/local/octave/3.8.0/bin:$PATH

to my path was indeed sufficient to enable oct2py to work properly (so long as I restarted my terminal after the change). Huzzah!

---- Original post ----

I have successfully pip installed oct2py and pexpect, but am running into issues when trying to import and use oct2py. First, when trying the following:

import oct2py

I received the following error message:

Please install GNU Octave and put it in your path

So I added the following lines to ~/usr/.bash_profile

export PATH=/usr/local/octave-3.8.0/bin:${PATH}
export PATH=/usr/local/octave-3.8.0/sbin:${PATH}

And now I am able to successfully import the oct2py module in python. However, when trying to initialize it with:

oc = oct2py.Oct2Py()

I get the same error message as before. What more do I need to add to the PATH to tell python how to actually run Octave? Is there perhaps another issue that I'm not aware of?

Edit: It appears that the initial 'import oct2py' still fails to recognize the PATH, but if I run that line a second time, it does not raise the same error message again. So presumably the PATH lines I've added already are not actually doing anything.

Upvotes: 5

Views: 4195

Answers (1)

djsensei
djsensei

Reputation: 193

Adding the following to .bash_profile enables oct2py to work properly.

export PATH=/usr/local/octave/3.8.0/bin:$PATH

Just make sure to restart the terminal after you update the PATH file!

Upvotes: 3

Related Questions