Install python & python3 and run python scripts with apache on your CentOS WebPanel server.

Install python

yum install python

Install python3

yum install python3

Check python version

python -V

Check python3 version

python3 -V

Create a test script

cd /home/USERNAME/public_html
mkdir cgi-bin
nano cgi-bin/test.py

Python2 test script in the file:
/home/USERNAME/public_html/cgi-bin/test.py

#!/usr/bin/python
# enable debugging
import cgitb
cgitb.enable()
print "Content-Type: text/plain\r\n\r\n"
print
print "Hello World!"

Python3 test script in the file:
/home/USERNAME/public_html/cgi-bin/test.py

#!/usr/bin/python3
# enable debugging
import cgitb
cgitb.enable()
print ("Content-Type: text/plain\r\n\r\n")
print
print ("Hello World!")

Update test.py file and folder cgi-bin permissions

chown -R USERNAME.USERNAME /home/USERNAME/public_html/cgi-bin
chmod +x /home/USERNAME/public_html/cgi-bin/test.py

Now create .htaccess file to handle this script.
Add this test code bellow in your file /home/USERNAME/public_html/cgi-bin/.htaccess

Options +ExecCGI
AddHandler cgi-script .py

Enable CGI
Create File: /usr/local/apache/conf.d/mod_cgid.conf

LoadModule cgid_module modules/mod_cgid.so

<IfModule cgid_module>
<Directory /home/*/public_html/cgi-bin/>
Options ExecCGI SymLinksifOwnerMatch
SetHandler cgi-script
AddHandler cgi-script .cgi .pl .py
Require all granted
AllowOverride All
</Directory>
</IfModule>

Now restart apache and you are ready to run your cgi-scripts.

service httpd restart

Test if cgid module is now loaded

/usr/local/apache/bin/httpd -M|grep cgid

Test if suexec module is now loaded

/usr/local/apache/bin/httpd -M|grep suexec

If module is loaded, you should get output containing this: suexec_module (shared)
http://wiki.centos-webpanel.com/how-to-enable-mod_suexec-with-apache

Running cgi scripts requires some security so don't forget to check this instructions
http://wiki.centos-webpanel.com/how-to-run-cgi-scripts-with-apache

Now you can run your python script by using URL

http://domain.com/cgi-bin/test.py