You are viewing the article How to Launch Python Files Using Windows Command Prompt at Lassho.edu.vn you can quickly access the necessary information in the table of contents of the article below.
This article is co-authored by a team of editors and trained researchers who confirm the accuracy and completeness of the article.
The wikiHow Content Management team carefully monitors the work of editors to ensure that every article is up to a high standard of quality.
This article has been viewed 49,381 times.
This wikiHow teaches you how to open Python files using the built-in Command Prompt program on Windows computers. In most cases, you will open the file without any problems as long as Python is available on the machine. If your computer uses an old version of Python, or you customized it when installing and did not add the “python” command to the “Path” variable list, proceed to add Python to the “Path” variable list to be able to start run the Python file through Command Prompt.
Steps
Find Python file path
- If you already know the directory path of the Python file to open, you can open the file on Command Prompt right away.
- You can copy the location by highlighting the information (click and drag your mouse over the “Location” value) and then press Ctrl + C .
Launch Python file
. Click the Windows icon in the lower left corner of the screen. The Start menu will pop up.
Command Prompt appears at the top of the Start menu. Command Prompt will open.
- For example, to open a Python file located in the “Files” folder on the Desktop, you need to enter cd desktop/Files here.
- If you copied the file path then type cd with a space and then press Ctrl + V to paste the path.
- For example, if the Python file is named “script” then you need to enter python script.py here.
- If the Python file has more than one space in the name, we enclose the name with the file extension in quotes (e.g. python "my script.py" ).
- If the error
'python' is not recognized as an internal or external command
appears after pressing Enter , you need to add Python to the PATH list and then try again.
Add Python to PATH list
- Open File Explorer
{“smallUrl”:”https://www.wikihow.com/images_en/0/04/File_Explorer_Icon.png”,”bigUrl”:”https://www.wikihow.com/images/thumb/0/04/ File_Explorer_Icon.png/30px-File_Explorer_Icon.png”,”smallWidth”:460,”smallHeight”:460,”bigWidth”:30,”bigHeight”:30,”licensing”:”<div class=”mw-parser-output “></div>”}
.
- Click the View tab.
- Check the “Hidden items” box.
- Click This PC on the left side of the File Explorer window.
- Double-click the hard drive located in the “Devices and drives” section.
- Scroll down and double-click the “Users” folder.
- Double-click the folder with your username.
- Scroll down and double click “AppData”.
- Double-click “Local”.
- Scroll down and double-click “Programs”.
- Double click on the “Python” folder.
- Double-click the Python folder with the appropriate version number (e.g. “Python36”).
. A menu will pop up.
- You can also press ⊞ Win + X to open the Power User pop-up menu.
- You may need to scroll your mouse pointer up or down on the “User variables” pane to find the “Path” variable.
This article is co-authored by a team of editors and trained researchers who confirm the accuracy and completeness of the article.
The wikiHow Content Management team carefully monitors the work of editors to ensure that every article is up to a high standard of quality.
This article has been viewed 49,381 times.
This wikiHow teaches you how to open Python files using the built-in Command Prompt program on Windows computers. In most cases, you will open the file without any problems as long as Python is available on the machine. If your computer uses an old version of Python, or you customized it when installing and did not add the “python” command to the “Path” variable list, proceed to add Python to the “Path” variable list to be able to start run the Python file through Command Prompt.
Thank you for reading this post How to Launch Python Files Using Windows Command Prompt at Lassho.edu.vn You can comment, see more related articles below and hope to help you with interesting information.
Related Search: