简体   繁体   English

如果我使用 Visual Studio 安装 python,如何从终端运行它?

[英]How to run python from the terminal if I installed it using Visual Studio?

I have installed python using Visual Studio, but I can't use python from the command prompt.我已经使用 Visual Studio 安装了 python,但是我无法在命令提示符下使用 python。 I also want to run python from the command prompt, but it is only accessible from Visual Studio.我也想从命令提示符运行 python,但它只能从 Visual Studio 访问。 I have tried adding the path of the directory in which Visual Studio has installed python to the user environment variables, but typing python in the command prompt opens up Windows Store.我尝试将 Visual Studio 安装 python 的目录的路径添加到用户环境变量中,但在命令提示符中键入 python 会打开 Windows 应用商店。 Please somebody help me with this.请有人帮我解决这个问题。 Is there any way around or do I have to install python separately too.有什么办法可以解决,或者我也必须单独安装python。

go to python.org and download the latest version of python (You can download it from the windows store too).转到python.org并下载最新版本的 python(您也可以从 Windows 商店下载)。 Then open a new terminal and write python --version .然后打开一个新终端并编写python --version

NOTE: Don`t forget the open a new terminal.

step1 : install the python from python.org (dont forget to check the PATH installation radio button) step1:从python.org安装python(不要忘记检查PATH安装单选按钮)

step2: check the python from CMD with command :步骤2:使用命令从CMD检查python:

python --version蟒蛇--版本

step3: go the project directory and run : step3:进入项目目录并运行:

python your_project_file_name.py python your_project_file_name.py

thanks for replying.感谢回复。 I figured out the answer myself, and thought to answer it for anyone in the future who comes across the same issue.我自己想出了答案,并想为将来遇到相同问题的任何人回答。

I went into settings->Apps我进入设置->应用程序

Find the python installation and click on it, select modify.找到python安装并点击它,选择修改。

Then click on "modify installation" when the python installation repair window opens, then again click on "modify", make sure to select "Add python to path", and also py launcher option also.然后在python安装修复窗口打开时单击“修改安装”,然后再次单击“修改”,确保选择“将python添加到路径”,还有py启动器选项。

That fixed the problem for me.那为我解决了问题。

Thanks, again.再次感谢。

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

相关问题 如何在终端Visual Studio Code中运行Python3函数脚本 - How to run Python3 function script in terminal Visual Studio Code 如何使用 Visual Studio Code 从不同的驱动器运行 python - How to run python from different drive using Visual Studio Code 如何检测使用python脚本安装的Visual Studio版本 - How do I detect the version of visual studio installed with a python script 如何从Linux终端使用./运行python? - How to run python using ./ from Linux terminal? 从bash终端运行Visual Python脚本 - Run Visual Python script from bash terminal 更改 Python:在 Visual Studio Code 的终端命令中运行 Python 文件 - Change Python:Run Python File in Terminal command in Visual Studio Code 尝试从我使用 pip3 安装的 github 运行程序。 但是当我尝试通过 Mac OS 终端运行时,它需要“Python 3.6+” - Trying to run a program from github which I've installed using pip3. But when I try to run in through the Mac OS terminal, it require's "Python 3.6+" Visual Studio Code Python 扩展“在终端中运行文件”不起作用 - Visual Studio Code Python extension 'Run File in Terminal' not working Visual Studio 代码(在终端中运行 Python 文件不起作用) - visual studio code (run Python file in terminal does not work) 如何在Visual Studio中使用特定的Python环境运行Python代码? - How to run Python code using a specific Python environment in Visual Studio?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM