Issue
I have python 3.4.3 and octave 3.6.4 installed on my computer. I installed oct2py 3.30 through the command pip install oct2py
and there were no errors shown, but when I try to run:
import numpy as np
from oct2py import octave
I get the following error:
File "C:/Users/myname/myfile.py", line 2, in <module>
from oct2py import octave
ImportError: cannot import name 'octave'
When looking for an answer I found a post from the creator explaining that when you import octave from oct2py you are importing a convenience instance of the Oct2Py
class, so I tried the following:
from oct2py import Oct2Py
running this gave me the message:
octave not found. Please see documentation at:
http://blink1073.github.io/oct2py/source/installation.html
but I've already done everything explained in the installation. Octave is in my path and if I open up the command prompt and type octave
it will run octave.
edit: It turns out that if I run these commands in python from the command prompt they work, I only get the errors when running them from Spyder IDE. The only problem I can think of is there might be a file in Spyders working directory that conflicts with something, but I can't find anything when looking at the files.
Solution
I thought I should update that this is working now. The following time I started Spyder after restarting my computer I ran the same script unchanged and it worked. I presume that my computer just needed restarting after adding Octave to the path. I didn't originally think this was the case since after altering the path I could now run Octave from the command line without restarting, but nothing else changed since the script not working, restarting my computer, and the script working now.
Answered By - AX2
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.