Set up the Python compilation environment under Linux and the solution to the error /bin/sh: 1: Python2.6: not found

Step 1:
Check if python is installed on your computer, enter python --version to check python2, and enter python3 --version to check python3.
Insert picture description hereStep 2:
Install geany compiler, geany is a free universal compiler that supports different systems For programming in different languages, enter geany and follow the installation prompt to enter sudo apt-get install geany to install.
Step 3:
Enter geany on the command line to open the compiler
Configure Build-Set Build Commands

Insert picture description hereAdd python2.6 -m py_compile "%f" to Compile in the window below, add python2.6 "%f" after Execute, of course you can also change 2.6 to other, as long as the computer has this version of python

Insert picture description here
Enter the test line print("hello"), click compile (or shortcut key F9), and run (or shortcut key F5) to see the output result.
Insert picture description here
Note:
/bin/sh: 1: Python2.6: not found this error appears The reason is that the appropriate suffix is ​​not used when saving the file, as long as the suffix of .py is added.

Guess you like

Origin blog.csdn.net/qq_43511299/article/details/108031744