Running python files on Putty

I am trying to run a file on Putty using “sudo python Filename.py”
the file is also created on the nano editor of putty
but on using the sudo python Filename.py an erros shows up that “sudo: pyton: command not found”
any help??

Hi @guneetbhatia.96 ,
It seems that you haven’t installed the python. First, install the python https://www.python.org/downloads/ .
Let me know in case you need further assistance.

Hi, as show in your command error, there is a typing error. It’s supposed to be python and not pyton. Please check and let me know it this solves the issue for you.

You can download the python installer from here for windows OS,


Download the required version for your use. Python 2.7.13 is widespread.

Linux systems come with python pre-installed. Else, you can run the following command,
sudo apt-get install python

Then verify if python is installed by running this command on the terminal,
python --version
It should display the version number of python.

Visit this link for more info,

1 Like

hi,
while running file by using sudo command, you should mention the version of the python.
For example : sudo python3 filename.py
hope this will help.

Hi @guneetbhatia.96
I guess you haven’t downloaded the packages from depository.
Use
sudo apt-get update
to download the latest packages