Ubuntu: run .py files in python? [duplicate]


This question already has an answer here:

I have a file called ikfast_generator_cpp.py in a directory called openrave-0.9.0-src/python under my home directory.

How do I run it in Python?


Start a terminal by clicking the appropriate icon on the left side of the screen.

In the terminal, change the current directory to the location of your file:

 cd ~/openrave-0.9.0-src/python  

(The ~ means "my home directory". I hope the rest of the line is clear.)

You should see the prompt change to include the new location. If you like you can check by typing


Now run the Python interpreter, giving it the name of the file to run:

python ikfast_generator_cpp.py  


To locate the file use:

$ locate ikfast_generator_cpp.py  

Then when you find the path it is in, copy the path and use the following command below.

Lets say the path to your file is openrave-0.9.0-src/python/ikfast_generator_cpp.py.

To run an executable .py (Python) file, use the command:

$ ./openrave-0.9.0-src/python/ikfast_generator_cpp.py  

or if it is not executable use:

$ python openrave-0.9.0-src/python/ikfast_generator_cpp.py  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »