简体   繁体   中英

How do I run the code I've written in my text editor?(sublime2)

Sorry for the really basic question, but my web searches have yielded poor results. I'm trying to make a simple text game right now and I know that my code is definitely wrong, but I want to try and run it and see what kind of feedback it gives to me. I've searched and found that ctrl + B is supposed to compile and run the code, but I get an error saying "The system cannot find the file specified". I have other programs such as the Python cmnd line and Vim but I'm not sure if they don't seem to help either. I'm the absolute epitome of the word beginner, so any help is definitely appreciated. Thank you so much!

On whatever OS(Linux/Windows/Mac OS), you can use command line to run your python script.

With something like:

    python xxx.py

If it says python not found, then you don't have python installed correctly OR it's not in the system PATH. Then search for how to add it to PATH.

First I would recommend using your file manager in to find the path to your file, for example in OSX you simply right click on your python file and select get info. If you discover the path to your file is ~/foobar/foo/bar.py, you should open up terminal and run

python ~/foobar/foo/bar.py

Hope this it explains it.

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