Running Python on the Command Line
Fixing MacOS error with Python3
Have you ever run into a problem executing a python3 file where you would get the following error:
- OSError: cannot open resource
- env: python3: Operation not permitted
- python3: bad interpreter: Operation not permitted.
Changes are you have the following header in that Python file:
To make it work, change the header to:
This is probably happening because Python3 is not pointing to the right version of Python3.
The easy fix, is put in the full path of Python3. For most installations, it should be /usr/bin/python3. (Apple does a good job of keeping up with the current Python version.)
One last thing...
If your still having problems, make sure that the file permissions are set correctly.
chmod 755 filename.py