Reputation: 678
When trying to enable linting with Pylint, and format on save with autopep8, neither will install because of a permission denied error.
Pylint:
IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/mccabe.py'
Autopep8:
IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pep8.py'
Upvotes: 7
Views: 10697
Reputation:
Use for Python V3+
sudo -H python -m pip install pylint
then simply check the version via
pylint --version
should output something like
pylint 2.6.2
astroid 2.4.2
Python 3.9.1 (default, Feb 1 2021, 12:12:57)
[Clang 12.0.0 (clang-1200.0.32.29)]
Upvotes: 0
Reputation: 3704
You can press ⬆ (up arrow key) in the terminal tab after the install fails to return to the command that it ran. In this case:
/usr/bin/python -m pip install pylint
Press fn+⬅ (left arrow key) to jump to the beginning of the line, then insert a 'sudo ' (no quotes, but including the trailing space) in front of the command, and press enter to re-run the command as root -- it should look like this:
sudo /usr/bin/python -m pip install pylint
You will be prompted for your password then the package will be installed without permissions errors.
Upvotes: 9