简体   繁体   English

如何让 VS Code 运行“python”而不是“& C:/Users/[username]/AppData/Local/Programs/Python/Python38/python.exe”?

[英]How do you get VS Code to run “python” instead of “ & C:/Users/[username]/AppData/Local/Programs/Python/Python38/python.exe”?

In the screenshot of the VS Code Python Tutorial , it shows the following command being run at the terminal after selecting "Run Python File at Terminal":VS Code Python 教程的屏幕截图中,它显示了在选择“在终端运行 Python 文件”后在终端运行以下命令:

python c:/py/hello/hello.py

在此处输入图像描述

When I run a Python file the same way, I get:当我以同样的方式运行 Python 文件时,我得到:

& C:/Users/[username]/AppData/Local/Programs/Python/Python38/python.exe c:/py/hello/hello.py

Is there a setting so that it will just run python instead of & C:/Users/[username]/AppData/Local/Programs/Python/Python38/python.exe ?是否有设置让它只运行python而不是& C:/Users/[username]/AppData/Local/Programs/Python/Python38/python.exe

EDIT Here's my Python Path setting编辑这是我的 Python 路径设置在此处输入图像描述

What you see is the full path to the Python version you are using as per your current settings.您看到的是您根据当前设置使用的 Python 版本的完整路径。

Check here在这里检查

Selecting an interpreter sets the python.pythonPath value in your workspace settings to the path of the interpreter.选择解释器会将工作区设置中的 python.pythonPath 值设置为解释器的路径。 To see the setting, select File > Preferences > Settings (Code > Preferences > Settings on macOS), then select the Workspace Settings tab.要查看设置,select 文件 > 首选项 > 设置(macOS 上的代码 > 首选项 > 设置),然后 select 工作区设置选项卡。

Note: If you select an interpreter without a workspace folder open, VS Code sets python.pythonPath in your user settings instead, which sets the default interpreter for VS Code in general.注意:如果您 select 是一个没有打开工作区文件夹的解释器,VS Code 会在您的用户设置中设置 python.pythonPath,这通常会为 VS Code 设置默认解释器。 The user setting makes sure you always have a default interpreter for Python projects.用户设置确保您始终拥有 Python 项目的默认解释器。 The workspace settings lets you override the user setting.工作区设置允许您覆盖用户设置。

To switch between different Python interpreters you have, you can do this.要在您拥有的不同 Python 解释器之间切换,您可以这样做。

From "view" in the menu bar select command palette ( or, then type in the search bar "Python: Select Interpreter", the different interpreters you have will show in results and you can pick the one you want从菜单栏中的“查看” select 命令面板(或者,然后在搜索栏中输入“Python:Select 解释器”,您拥有的不同解释器将显示在结果中,您可以选择您想要的解释器

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 VsCode 中的“C:\Users\AccountName\AppData\Local\Programs\Python\Python38-32\python.exe”错误中没有 python - no python at "C:\Users\AccountName\AppData\Local\Programs\Python\Python38-32\python.exe" error in VsCode PyCharm Python 解释器错误“'C:\Program Files\Python38\python.exe' 处没有 python - PyCharm Python interpreter error "No python at 'C:\Program Files\Python38\python.exe' 为什么我得到 (gsutil): "C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python37\\python.exe": command not found - why am i getting (gsutil): "C:\Users\user\AppData\Local\Programs\Python\Python37\python.exe": command not found 无法使用“C:\Users\Abhishek Anand\AppData\Local\Programs\Python\Python310\python.exe manage.py runserver”创建进程 - Unable to create process using 'C:\Users\Abhishek Anand\AppData\Local\Programs\Python\Python310\python.exe manage.py runserver' 没有 Python 在 'C:\Users\PC\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' - No Python at 'C:\Users\PC\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' 如何将项目重新路由到 PyCharm 中的另一个 Python 版本? (错误:'C:\Users\...\python.exe' 处没有 Python) - How do I reroute a project to another Python version in PyCharm? (Error: No Python at 'C:\Users\…\python.exe') Python:pipenv 错误(ValueError:不是有效的 Python 路径:'C:/Users/LGIT/$USERPROFILE$/Local/Programs/Python2/Python27/Scripts/python.exe') - Python: pipenv Error (ValueError: Not a valid python path: 'C:/Users/LGIT/$USERPROFILE$/Local/Programs/Python2/Python27/Scripts/python.exe') openSuse 15.2 没有 python38 pip - openSuse 15.2 no python38 pip '\\python.exe' 中没有 python - No python at '\python.exe' 无法导入 C:\\Users\\username\\Anaconda3\\python.exe 时如何访问 Pycharm 中的 Anaconda 基础环境? - How to access the Anaconda base environment in Pycharm when I cannot import C:\Users\username\Anaconda3\python.exe?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM