在python2.7.9中导入oct2py会产生WindowsError:[错误2]系统找不到指定的文件

时间:2017-03-28 08:44:34

标签: python-2.7 octave oct2py

导入oct2py模块时,这里是我得到的..

>>> import oct2py

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import oct2py
  File "C:\Python27\lib\site-packages\oct2py\__init__.py", line 38, in <module>
    octave = Oct2Py()
  File "C:\Python27\lib\site-packages\oct2py\core.py", line 73, in __init__
    self.restart()
  File "C:\Python27\lib\site-packages\oct2py\core.py", line 508, in restart
    logger=self.logger)
  File "C:\Python27\lib\site-packages\octave_kernel\kernel.py", line 144, in __init__
    self.repl = self._create_repl()
  File "C:\Python27\lib\site-packages\octave_kernel\kernel.py", line 338, in _create_repl
    version = subprocess.check_output(version_cmd).decode('utf-8')
  File "C:\Python27\lib\subprocess.py", line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "C:\Python27\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

我已经搜索了更多的线程,他们谈到了python shell的子处理,但我没有得到如何做到这一点。所以有人请帮我解决这个问题。

1 个答案:

答案 0 :(得分:1)

当我将错误的目录添加到PATH时,这发生在我身上。我补充道  C:\Octave\Octave-4.2.1\ 而不是正确的 C:\Octave\Octave-4.2.1\bin\

在导入oct2py时,它会查找\bin目录中的octave-cli.exe可执行文件。

另见PostGreSQL