'How to resolve "bad interpreter: Permission denied" with #! /usr/bin/python3
I'm trying to use the '#! /usr/bin/python3' on a centos7 but since I had to
install Python3 via:
Yum install centos-release-scl
Yum install rh-python36
scl enable rh-python36 bash
The Python3 isn't in the /usr/bin/python3
I tried using:
#! /opt/rh/rh-python36
I get these errors when trying to run a python script
bash: ./pw.py: /opt/rh/rh-python36: bad interpreter: Permission denied
./pw.py: /opt/rh/rh-python36: bad interpreter: Permission denied
Solution 1:[1]
This means your folder permissions are not allowing you to use that interpreter. Please verify that /opt/rh/rh-python36 has it's permissions set so that you can read and execute there, otherwise it will give you a permission denied error.
sudo chmod -R 755 /opt/rh/rh-python36/
Solution 2:[2]
Easy, but not elegant fix: Try downloading a local user version of Python and reference that local Python3 file #! /local/path/python3.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Column01 |
| Solution 2 | bad_coder |
