簡體   English   中英

即使我的路徑正確,Sublime3 中也無法識別 Python?

[英]Python is not recognized in Sublime3 even though my path is correct?

如果我在 Python 上運行基本的 IDLE,它會運行我的腳本,但是當我嘗試通過 Sublime 3 運行它們時,它會指出無法識別 Python。 即使 Python 已經添加到我的路徑中也是如此。

另一個奇怪的事情是,當我在命令行中輸入python ,它無法識別,但如果輸入py ,它會顯示 Python 版本。

這是路徑:

[path:C:\ProgramFiles(x86)\NVIDIACorporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramFiles(x86)\ATITechnologies\ATI.ACE\CoreStatic;C:\ProgramFiles\dotnet\;C:\Users\Tommy\AppData\Local\Programs\Python\Python37\Scripts]

python.exe文件必須位於PATH變量中列出的目錄之一中。

如果它不在

C:\Users\Tommy\AppData\Local\Programs\Python\Python37\Scripts

那么你必須添加另一個目錄。 我的猜測是Python37目錄。

您的 PATH 還應指向

C:\Users\Tommy\AppData\Local\Programs\Python\Python37\

它只是指向 Python 的腳本,而不是 Python 本身。

Sublime 嘗試使用"python" ,但由於它不在 PATH 中,因此不起作用。 您的命令行也是如此。

如果你指向我使用的文件夾,它會尋找Python 3.7,如果你需要使用其他Python的版本,你可以使用py helper。

例如,對於 Python 3.6:

py -3.6 <script>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM