简体   繁体   中英

visual studio code (run Python file in terminal does not work)

visual studio code, 截屏 pressing run does not work on mac. Let say I want to print the word "Hello" and run the code print("Hello"), it will not be executed. I tried reinstalling python and visual studio but I could't resolve the problem.

I ran into the same issue. Figured out that I forgot to select the Add Python 3.8 to PATH while installing. You can either choose to uninstall and reinstall Python and make sure to select the above option OR you can manually update the user environment variable for PATH and add the path to scripts and python like the following.

C:\Users\<addyourusernamehere>\AppData\Local\Programs\Python\Python38-32\Scripts\
C:\Users\<addyourusernamehere>\AppData\Local\Programs\Python\Python38-32\

When this happens to me, the Python interpreter borked and I need to press ctrl + c (abort) in the terminal a couple of times. It's still in the Python process and vscode is trying to input the run command into a Python process that's not actually a terminal.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM