> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Python script basics

> Get a head start on Python basics: learn script file permissions, file extensions, and available versions on Hosting.com servers.

This article provides essential information about using Python on hosting.com servers.

## What permissions do I need to set for my Python script files?

The correct permissions for Python script files depends on the script's particular function:

* For Python CGI script files that are publicly accessible through the web, you should set the file permissions to **755** (read, write, and execute permissions for the user, and read and execute permissions for the group and world). You do **not** need to give the world write permissions to the Python script.

* For Python script files that you only run on the command line, you should set the file permissions to **700** (read, write, and execute permissions for the user, and no permissions for the group and world).

## What file extensions can I use for my Python script files?

Python script files can have a .py or .cgi extension. However, as with file permissions, the file extension you use generally depends on the script's function:

* Python CGI script files that generate web output accessible to the public use the .cgi extension.
  > 👍 Tip
  >
  > If you want to use the .py extension for Python CGI script files, then you must [add an Apache handler](/docs/apache-handlers).

* Python script files that you only run from the command line, and script files which do not generate web output, should use the .py extension.

## What version of Python is installed on hosting.com servers?

To determine which Python version is the default for your server, type the following command at the command line:

```bash theme={null}
python -V
```

<Note>
  You can run different versions of the Python executable. See the following section.
</Note>

## What is the path to the Python executable?

The absolute path to the default Python executable on our servers is **/usr/bin/python**. The /usr/bin directory is in the default path, however, so generally you do not need to include the full path when you run Python scripts from the command line. Just type the following command, replacing *filename* with the name of your script file:

```bash theme={null}
python filename
```

### Running different Python versions

There are several different versions of the Python executable available for you to use. To view the Python versions available on your server, type the following command at the command line:

```bash theme={null}
ls /usr/bin/python*
```

For example, to run a script using Python version 3, type the following command. Replace *filename* with the name of your script file:

```bash theme={null}
python3 filename
```

<Note>
  Shared and Reseller servers also have the Python Selector available in cPanel to make different Python versions available. For Shared and Reseller servers running Centos 7, the Python Selector is the only method available to use different versions of Python. Instructions for the use of the Python Selector are in [this article](/docs/using-the-python-selector).
</Note>

## Can I use the mod\_python Apache module?

Hosting.com does not support the mod\_python module on shared web hosting accounts. If you have a dedicated server or VPS however, you can install and run the mod\_python module.

## More information

To view the official online Python documentation, please visit [http://docs.python.org](https://docs.python.org).
