[英]Jupyter Notebook Octave Kernel: %1 is not a valid Win32 application
I recently started working with Octave on Jupyter notebook.我最近开始在 Jupyter notebook 上使用 Octave。 I was previously working on a Linux laptop but then I thought about creating a similar working environment on my Windows laptop.我以前在 Linux 笔记本电脑上工作,但后来我想在我的 Windows 笔记本电脑上创建一个类似的工作环境。 I followed more or less the same approach.我遵循或多或少相同的方法。
I already have Octave installed on my Windows laptop and I have added C:\Program Files\GNU Octave\Octave-6.1.0\mingw64\bin
to the PATH
environment variable.我的 Windows 笔记本电脑上已经安装了 Octave,并且我已将C:\Program Files\GNU Octave\Octave-6.1.0\mingw64\bin
添加到PATH
环境变量中。 I also have set OCTAVE_EXECUTABLE
to octave-cli
in the environment variables.我还在环境变量中将OCTAVE_EXECUTABLE
设置为octave-cli
。
I created a virtual environment using the following command.我使用以下命令创建了一个虚拟环境。
python -m venv octave
Then I activated the virtual environment from the desired working directory and installed Jupyter in it using the following command.然后我从所需的工作目录中激活了虚拟环境,并使用以下命令在其中安装了 Jupyter。
pip install jupyter
Then I installed the Octave kernel using the following command.然后我使用以下命令安装了 Octave kernel。
pip install octave-kernel
After that, when I ran the following command to see if things are working or not I got the error mentioned further below.之后,当我运行以下命令以查看事情是否正常时,我得到了下面进一步提到的错误。
(octave) λ python -m octave_kernel.check
Octave kernel v0.32.0
Metakernel v0.27.5
Python v3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)]
Python path: C:\Workspace\python-virtual-environments\octave\Scripts\python.exe
Connecting to Octave...
Octave connection established
[WinError 193] %1 is not a valid Win32 application
When I start jupyter-notebook
and open a notebook, I end up getting the same error.当我启动jupyter-notebook
并打开笔记本时,我最终得到了同样的错误。
[I 15:20:33.465 NotebookApp] Kernel started: 92de579a-c8df-4cf8-9ec4-dbb9aefa1fe5, name: octave
[MetaKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
File "c:\workspace\python-virtual-environments\octave\lib\site-packages\ipykernel\kernelbase.py", line 265, in dispatch_shell
yield gen.maybe_future(handler(stream, idents, msg))
File "c:\workspace\python-virtual-environments\octave\lib\site-packages\ipykernel\kernelbase.py", line 655, in kernel_info_request
content.update(self.kernel_info)
File "c:\workspace\python-virtual-environments\octave\lib\site-packages\ipykernel\kernelbase.py", line 648, in kernel_info
'language_info': self.language_info,
File "c:\workspace\python-virtual-environments\octave\lib\site-packages\octave_kernel\kernel.py", line 78, in language_info
'version': self.language_version,
File "c:\workspace\python-virtual-environments\octave\lib\site-packages\octave_kernel\kernel.py", line 69, in language_version
ver = self.octave_engine.eval('version', silent=True)
File "c:\workspace\python-virtual-environments\octave\lib\site-packages\octave_kernel\kernel.py", line 96, in octave_engine
logger=self.log)
File "c:\workspace\python-virtual-environments\octave\lib\site-packages\octave_kernel\kernel.py", line 173, in __init__
self.repl = self._create_repl()
File "c:\workspace\python-virtual-environments\octave\lib\site-packages\octave_kernel\kernel.py", line 392, in _create_repl
force_prompt_on_continuation=True)
File "c:\workspace\python-virtual-environments\octave\lib\site-packages\metakernel\replwrap.py", line 63, in __init__
encoding="utf-8")
File "c:\workspace\python-virtual-environments\octave\lib\site-packages\metakernel\pexpect.py", line 32, in spawn
encoding=encoding, codec_errors=codec_errors)
File "c:\workspace\python-virtual-environments\octave\lib\site-packages\pexpect\popen_spawn.py", line 53, in __init__
self.proc = subprocess.Popen(cmd, **kwargs)
File "C:\Program Files\Python36\lib\subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "C:\Program Files\Python36\lib\subprocess.py", line 1017, in _execute_child
startupinfo)
OSError: [WinError 193] %1 is not a valid Win32 application
What am I doing wrong here?我在这里做错了什么?
I tried changing the OCTAVE_EXECUTABLE
environment variable to octave
but I got the following error.我尝试将OCTAVE_EXECUTABLE
环境变量更改为octave
,但出现以下错误。
(octave) λ python -m octave_kernel.check
Octave kernel v0.32.0
Metakernel v0.27.5
Python v3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)]
Python path: C:\Workspace\python-virtual-environments\octave\Scripts\python.exe
Connecting to Octave...
Octave connection established
OCTAVE_EXECUTABLE does not point to an octave-cli file, please see README
It looks like the kernel used does not work with Octave 6. I had the same problem with Octave 6.2.0.看起来使用的 kernel 不适用于 Octave 6。我在使用 Octave 6.2.0 时遇到了同样的问题。 OCTAVE_EXECUTABLE and PATH were set correctly according to installation instructions, but without success.根据安装说明正确设置了 OCTAVE_EXECUTABLE 和 PATH,但没有成功。 The octave kernel chek error message is: [WinError 193] %1 is not a valid Win32 application.八度音阶 kernel 错误消息是:[WinError 193] %1 不是有效的 Win32 应用程序。 But with Octave 5.2 everything works fine.但是使用 Octave 5.2 一切正常。 I work with jupyter under winpython 3.9.2我在 winpython 3.9.2 下使用 jupyter
Problem resolved.问题已解决。 Octave 6.2.0 and winpython 3.9.4 completely reinstalled. Octave 6.2.0 和 winpython 3.9.4 完全重新安装。 Path and environment variable set: Path —>D:\Octave\Octave-6.2.0\mingw64\bin OCTAVE_EXECUTABLE —> D:\Octave\Octave-6.2.0\mingw64\bin\octave-cli.exe now it works suddenly without errors with Octave 6.2.0.路径和环境变量设置:Path —>D:\Octave\Octave-6.2.0\mingw64\bin OCTAVE_EXECUTABLE —> D:\Octave\Octave-6.2.0\mingw64\bin\octave-cli.exe 现在突然工作了Octave 6.2.0 没有错误。 The only difference from the previous installation is winpython 3.9.4 instead of 3.9.2与之前安装的唯一区别是 winpython 3.9.4 而不是 3.9.2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.