我的 Windows 10 计算机上安装了现有的普通 Python,但我不想重新安装 Anaconda。
当尝试在 vscode 中运行 ipynb 文件中的代码时,出现以下错误:
Error: Jupyter cannot be started. Error attempting to locate jupyter:
at A.startServer (c:\Users\[username]\.vscode\extensions\ms-python.python-2020.2.64397\out\client\extension.js:1:786120)
at async A.ensureServerAndNotebookImpl (c:\Users\[username]\.vscode\extensions\ms-python.python-2020.2.64397\out\client\extension.js:1:785575)
at async A.ensureServerAndNotebook (c:\Users\[username]\.vscode\extensions\ms-python.python-2020.2.64397\out\client\extension.js:1:785376)
at async A.submitCode (c:\Users\[username]\.vscode\extensions\ms-python.python-2020.2.64397\out\client\extension.js:1:782328)
at async A.reexecuteCell (c:\Users\[username]\.vscode\extensions\ms-python.python-2020.2.64397\out\client\extension.js:75:879318)
Also with the following error from VSCode:
以下是我尝试过的一些事情:
检查VSCode扩展是否正确安装
“Jupyter”扩展已被弃用。我安装了 Microsoft 的“Python”插件,其中包含 Jupiter Notebook 支持。
Jupyter安装正确
我尝试重新安装 jupyter:
> python -m pip install --upgrade pip
> pip install jupyter
> pip install notebook
尝试在终端/命令行上运行 Jupyter
> jupyter notebook //didn't work
jupyter : The term 'jupyter' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ jupyter
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (jupyter:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
这给出了无法找到 jupyter 可执行文件的错误。
根据这个帖子我尝试了以下方法并且有效:
> python -m notebook
检查是否指向正确的解释器
As per 这个帖子我试过:
- 按 Command+Shift+P 打开新的命令面板
- 输入>Python:选择Intepreter启动jupyter笔记本服务器
但我的计算机上只安装了一个版本的 Python,这样做并没有什么区别。
检查路径
有这样一条评论PYTHONPATH
in 这个帖子但由于 python 目录被正确引用并且python
从命令行工作,我没有进一步研究它。
需要注意的一件事是pip
安装到我的"C:/Users/[username]/appdata/Roaming/Python-38/"
我的Python安装在文件夹中"C:\Program Files\Python38-32\"
.