oct2py导入错误:系统找不到指定的文件

时间:2017-07-20 13:55:01

标签: python octave oct2py

我试图在我的一个python脚本中使用oct2py,我在C:\Octave\Octave-4.2.1中安装了八度音,并为我的用户帐户的PATH变量添加了C:\Octave\Octave-4.2.1。当我运行from oct2py import octave时,我收到以下错误:

Traceback (most recent call last):
  File "C:\Users\CVanCleef\Desktop\cvancleef reconstruction\filterTestin.py", line 12, in <module>
    from oct2py import octave
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\oct2py\__init__.py", line 38, in <module>
    octave = Oct2Py()
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\oct2py\core.py", line 73, in __init__
    self.restart()
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\oct2py\core.py", line 508, in restart
    logger=self.logger)
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\octave_kernel\kernel.py", line 144, in __init__
    self.repl = self._create_repl()
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\octave_kernel\kernel.py", line 338, in _create_repl
    version = subprocess.check_output(version_cmd).decode('utf-8')
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\subprocess.py", line 316, in check_output
    **kwargs).stdout
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\subprocess.py", line 383, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\subprocess.py", line 676, in __init__
    restore_signals, start_new_session)
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\subprocess.py", line 955, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

编辑:在我的路径中添加OCTAVE_EXECUTABLE后,我收到错误

Traceback (most recent call last):
  File "C:\Users\CVanCleef\Desktop\cvancleef reconstruction\filterTestin.py", line 12, in <module>
    from oct2py import octave
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\oct2py\__init__.py", line 38, in <module>
    octave = Oct2Py()
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\oct2py\core.py", line 73, in __init__
    self.restart()
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\oct2py\core.py", line 508, in restart
    logger=self.logger)
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\octave_kernel\kernel.py", line 144, in __init__
    self.repl = self._create_repl()
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\site-packages\octave_kernel\kernel.py", line 338, in _create_repl
    version = subprocess.check_output(version_cmd).decode('utf-8')
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\subprocess.py", line 316, in check_output
    **kwargs).stdout
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\subprocess.py", line 383, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\subprocess.py", line 676, in __init__
    restore_signals, start_new_session)
  File "C:\Users\CVanCleef\AppData\Local\Continuum\Anaconda3\lib\subprocess.py", line 955, in _execute_child
    startupinfo)
PermissionError: [WinError 5] Access is denied

2 个答案:

答案 0 :(得分:1)

更改PATH变量后是否重新启动了系统?

我在加载到其他模块之前遇到过此问题,并通过重新启动系统解决了这个问题。

答案 1 :(得分:0)

通过添加路径变量OCTAVE_EXECUTABLE并将OCTAVE_EXECUTABLE值设置为C:\Octave\Octave-4.2.1\bin\octave-cli.exe来修复。我还从PATH

中删除了八度音程