0

我正在尝试在我的一个 python 脚本中使用 oct2py,我已经安装了 octaveC:\Octave\Octave-4.2.1并已为我的用户帐户添加C:\Octave\Octave-4.2.1到我的 PATH 变量中。当我运行时,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
4

2 回答 2

1

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

我之前在加载不同的模块并通过重新启动系统解决它之前遇到过这个问题。

于 2017-07-20T14:03:00.557 回答
1

通过添加路径变量 OCTAVE_EXECUTABLE 并将 OCTAVE_EXECUTABLE 值设置为 来修复C:\Octave\Octave-4.2.1\bin\octave-cli.exe。我还从我的 PATH 中删除了八度参考

于 2017-07-20T15:54:49.157 回答