Run python script from anywhere in terminal #linux #linuxcommands #kalilinux #scripts

 Step:1

Add the path of your python folder or file to environment variables in linux just open ~/.zshrc or ~/.bashrc with any txt editor and how u know that what shell u are using just type echo $0 or echo $SHELL u will get your shell name if bash then update ~/.bashrc or if zsh then update ~/.zshrc.


Step:2

source ~/.zshrc or ~/.bashrc


Step:3

Make sure that in your python file this shebang is adder #!/usr/bin/env python3.


Step:4

Now u are ready to go just reboot if not working.

Comments