[英]Atom: Error running Hydrogen, python.exe can't be found
I've recently run a complete reinstallation of Anaconda
, as well as Atom
with Script
and Hydrogen
.我最近运行了完整的
Anaconda
重新安装,以及带有Script
和Hydrogen
Atom
。 Before the reinstallation everything ran fine.在重新安装之前一切正常。 Now, when trying to execute a Python script line using
Ctrl+Enter
I'm getting the following error:现在,当尝试使用
Ctrl+Enter
执行 Python 脚本行时,出现以下错误:
'C:\\Users\\vestland\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe' is not recognized as an internal or external command, operable program or batch file.
And that's no wonder, because there is no python.exe
in that folder.这也难怪,因为该文件夹中没有
python.exe
。 It's in 'C:\\Users\\vestland\\AppData\\Local\\Programs\\Python\\Python37-32\\SCRIPT\\python.exe'
.它在
'C:\\Users\\vestland\\AppData\\Local\\Programs\\Python\\Python37-32\\SCRIPT\\python.exe'
。 How can I change that reference within Atom?如何在 Atom 中更改该引用?
I've tried adding 'C:\\Users\\vestland\\AppData\\Local\\Programs\\Python\\Python37-32\\SCRIPT\\python.exe'
to PATH
but to no avail.我尝试将
'C:\\Users\\vestland\\AppData\\Local\\Programs\\Python\\Python37-32\\SCRIPT\\python.exe'
到PATH
但无济于事。
I've also tried editing the Hydrogen kernel.json
file as per the suggestion here to:我还尝试根据此处的建议编辑 Hydrogen
kernel.json
文件:
{
"display_name": "MyPython3",
"argv": [
"C:\\Users\\vestland\\AppData\\Local\\Programs\\Python\\Python37-32\\scripts\\python.exe",
"-m",
"ipykernel",
"-f",
"{connection_file}"
],
"language": "python"
}
Thank you for any suggestions!感谢您的任何建议!
Edit:编辑:
Running Python using ctrl+shift+b
works just fine!使用
ctrl+shift+b
运行 Python 效果很好! But that's a command for the Script
package and not Hydrogen
.但这是
Script
包的命令,而不是Hydrogen
。
If you python location is C:\\Users\\vestland\\AppData\\Local\\Programs\\Python\\Python37-32\\SCRIPT\\python.exe
the kernel.json
file has an additional s
in scripts
, the correct version would be:如果您的 python 位置是
C:\\Users\\vestland\\AppData\\Local\\Programs\\Python\\Python37-32\\SCRIPT\\python.exe
则kernel.json
文件在scripts
有一个额外的s
,正确的版本是:
{
"display_name": "MyPython3",
"argv": [
"C:\\Users\\vestland\\AppData\\Local\\Programs\\Python\\Python37-3\\SCRIPT\\python.exe",
"-m",
"ipykernel",
"-f",
"{connection_file}"
],
"language": "python"
}
But I would suggest that kernel.json
uses the python default from the PATH
only you are not planning to use any virtual environment.但我建议
kernel.json
使用PATH
的 python 默认值,只是您不打算使用任何虚拟环境。
{
"display_name": "MyPython3",
"argv": [
"python.exe",
"-m",
"ipykernel",
"-f",
"{connection_file}"
],
"language": "python"
}
If that doesn't work, check if the system kernel folder is used instead, you can find it in %PROGRAMDATA%\\jupyter\\kernels
如果这不起作用,请检查是否使用系统内核文件夹,您可以在
%PROGRAMDATA%\\jupyter\\kernels
找到它
I've tried adding 'C:\\Users\\\\AppData\\Local\\Programs\\Python\\Python37-32\\SCRIPT\\python.exe' to PATH but to no avail.
我尝试将 'C:\\Users\\\\AppData\\Local\\Programs\\Python\\Python37-32\\SCRIPT\\python.exe' 添加到 PATH 但无济于事。
Try adding 'C:\\Users\\\\AppData\\Local\\Programs\\Python\\Python37-32\\SCRIPT\\' to PATH instead and restart Atom.尝试将 'C:\\Users\\\\AppData\\Local\\Programs\\Python\\Python37-32\\SCRIPT\\' 添加到 PATH 并重新启动 Atom。 (In other words add the folder containing the exe instead of the path\\filename.)
(换句话说,添加包含 exe 的文件夹而不是路径\\文件名。)
Solution: Remove lurking kernels!解决方案:去除潜伏的内核!
For some unknown reason, after countless reinstallations of Python, Atom, Script, Hydrogen and various attempts of不知什么原因,在无数次重装 Python、Atom、Script、Hydrogen 和各种尝试后
python -m pip install ipykernel
python -m ipykernel install --user
... I found a rogue kernel lurking in the depths of ...我发现了一个潜伏在深处的流氓内核
C:\Users\vestland\AppData\Roaming\jupyter\kernels\python3
As you can see from the screenshot, it's been there for quite some time despite my countless efforts to reset the entire system:正如您从屏幕截图中看到的,尽管我为重置整个系统付出了无数努力,但它已经存在了很长一段时间:
So I just deleted it, fired up Atom using a command prompt and atom .
所以我只是删除了它,使用命令提示符和
atom .
启动了 Atom atom .
, and now everything runs just fine using keyboard shortcuts for Hydrogen: ,现在使用 Hydrogen 的键盘快捷键一切正常:
The details:细节:
Running C:\\>jupyter kernelspec list --json
returned:运行
C:\\>jupyter kernelspec list --json
返回:
{
"kernelspecs": {
"1450be76-28c2-4c3d-a5f0-c56b3ef13d75": {
"resource_dir": "C:\\Users\vestland\AppData\\Roaming\\jupyter\\kernels\\1450be76-28c2-4c3d-a5f0-c56b3ef13d75",
"spec": {
"argv": [
"C:\\Users\\vestland\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe",
[...]
}
},
"python3": {
"resource_dir": "C:\\Users\vestlad\AppData\\Roaming\\jupyter\\kernels\\python3",
"spec": {
"argv": [
"C:\\Users\\vestland\\AppData\\Local\\Programs\\Python\\Python38-32\\python.exe",
[...]
}
}
}
}
And that turned out to be the culprit of the problem and why I could not rid myself of the C:\\\\Users\\\\vestland\\\\AppData\\\\Local\\\\Programs\\\\Python\\\\Python37-32\\\\python.exe
error message.结果证明这是问题的罪魁祸首,也是为什么我无法摆脱
C:\\\\Users\\\\vestland\\\\AppData\\\\Local\\\\Programs\\\\Python\\\\Python37-32\\\\python.exe
错误信息。 Somehow, Hydrogen picked up on that directory each time I tried to do something with Hydrogen and Atom.不知何故,每次我尝试使用 Hydrogen 和 Atom 做一些事情时,Hydrogen 都会选择该目录。
Running jupyter kernelspec list
showed me the locations of these kernels:运行
jupyter kernelspec list
向我展示了这些内核的位置:
Available kernels:
1450be76-28c2-4c3d-a5f0-c56b3ef13d75 C:\Users\vestland\AppData\Roaming\jupyter\kernels\1450be76-28c2-4c3d-a5f0-c56b3ef13d75
python3 C:\Users\vestland\AppData\Roaming\jupyter\kernels\python3
A simple deletion of the former kernel solved all problems.简单地删除以前的内核就解决了所有问题。 For now...
目前...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.