WinError 2: 系统找不到指定的文件

问题描述 投票:0回答:1

我是全新的 Python 编辑器设置者。我正在尝试设置 Sublime Text 以开始为我的工作学习 Python。

我已经设置了编辑器并尝试使用 Sublime 中的 Python 构建运行“Hello World”文本。

出现如下错误信息:

[WinError 2] The system cannot find the file specified
[cmd: ['py', '-u', 'C:\\Users\\myname\\OneDrive\\Documents\\Python_Projects\\intro.py']]
[dir: C:\Users\myname\OneDrive\Documents\Python_Projects]
[path: C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\MATLAB\R2021a\bin;C:\Users\myname\AppData\Local\Microsoft\WindowsApps;]
[Finished]

我尝试直接使用自动构建设置和 python 构建设置运行代码。仍然没有运气。

我看到在“路径:”中调用了一个 MATLAB 文件目录,我想这可能是干扰?

谢谢!

python sublimetext3
1个回答
0
投票

我假设如果您正在使用 Sublime Text,那么您已经从 Python.org 下载并安装了 Python 的可执行版本。为了以防万一,我在这里展示了一个参考。

所以,根据您的错误消息,您的“windows PATH”中似乎没有对 Python.exe 的引用。也许您忘记标记“将 Python.exe 添加到 PATH”框。就在这里。

有一种方法可以手动添加它,这里是解释它的帖子的链接:Adding Python to PATH on Windows

但就我而言,我更喜欢同时卸载“Sublime Text”和“Python”并重新安装,我从 Python 开始(不要忘记选中“路径”框)然后安装 Sublime Text

您应该通过在 Sublime Text 菜单栏的工具框中选中它来验证一切正常。您安装的 Python 版本将出现在那里。

© www.soinside.com 2019 - 2024. All rights reserved.