Reputation: 21
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
Upvotes: 2
Views: 24336
Reputation: 440
Just check which Python interpreter is active using either which python
or type python
commands. Enter the path output by either of the two commands in Shebang and the script should run.
Upvotes: 0
Reputation: 1
$ vim /usr/bin/yum
in this file, edit it to
!# *****/bin/python2.7
Upvotes: 0
Reputation: 1
Easy, but not elegant fix: Try downloading a local user version of Python and reference that local Python3 file #! /local/path/python3
.
Upvotes: 0
Reputation: 151
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/
Upvotes: 2