-1

I am a beginner trying to learn Python. I wrote a program using Geany and would like to build and execute it but I keep getting this error: "The system cannot find the path specified". I believe I added the right info to the Path though:

Compile  C:\Python373\python -m py_compile "%f"
Execute C:\Python373\python "%f"

this doesn't work. Can anyone help me figure it out. Thank you.

2 Answers 2

0

You have to be sure about the path of the python. So use this

import sys

print(sys.path)

For Python36 the path is as following:

C:\Users\user\AppData\Local\Programs\Python\Python36

In Python 3

Under 'Python commands', look for the 'Compile' line. Enter the following in the 'Command' box. Make sure you get the spaces right. You should have 'C:\Python34\python' followed by a space, and the rest of the command. If you have 'Python 34', with a space between Python and 34, Geany will not be able to run your code. Also, make sure your capitalization matches what you see here exactly.

C:\Python34\python -m py_compile "%f"

or use the path as the following

C:\Users\user\AppData\Local\Programs\Python\Python36 -m py_compile "%f"

Under 'Execute commands', look for the 'Execute' line. Enter the following in the 'Command' box, paying attention once again to the spaces.

C:\Python34\python "%f" or C:\Users\user\AppData\Local\Programs\Python\Python36 "%f"

Test your setup by running hello.py again.

Python 2

If you installed Python 2.7 instead of Python 3, the commands you want are probably:

C:\Python27\python -m py_compile "%f" or path of your python -m py_compile "%f" and

C:\Python27\python "%f" or path of your python "%f"

See this link for more information:http://introtopython.org/programming_environment_windows.html

3
0

@Bryan McCormack, At the Compile and Execute command field only, type python (of course matching the small letter case as in python.exe) without specifying the full python directory. Like:

Compile: python -m py_compile "%f"
Execute: python "%f"

Then just click OK, and Compile and Execute. Hope it will run the program well. If also, at the time of python installation there is no environment path is set, then set the python directory to the environment variable using command set or manually from the Control Panel > System > Advanced System Setting > Environment Variables > Path

NB: All the Configuration settings of Geany Execute command can be found at the Geany_install_directory\data\filedefs\filetypes.python for python file type at line:

[build_menu]
FT_00_LB=_Compile
FT_00_CM=python -m py_compile "%f"
EX_00_LB=_Execute
EX_00_CM=python "%f"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.