I have a centos 7 VM and I need sudo permissions to run certain shell commands in a python script. I have a
#!/usr/bin/env python3.7 at the top of my script and running it as
sudo ./script.py gives me a
/usr/bin/env: python3.7: No such file or directory error. How do I run my code as sudo? Just to clarify, it does run if I simply enter
./script.py, but I get a
permission denied when the script tried to execute 3 specific commands hence the need for sudo.
echo $PATH result:
sudo echo $PATH gives the same result as above.
type python3.7 gives me:
python3.7 is /usr/local/bin/python3.7