To install a Python package on Macintosh
- Download the Python package to your workstation,
- Unpack the package,
- Open a terminal window,
- Start sudo,
- Change to the directory of the package,
- Install the package.
pip install PACKAGE_NAME
If you don’t install the package in sudo mode, you will get “Permission denied” errors during the package installation.
When you encounter the warning message
WARNING: The directory ‘/Users/…/Library/Caches/pip’ or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo’s -H flag.
To make yourself the owner of the /Users/…/Library/Caches/pip directory execute
sudo chown -R $(whoami) ~/Library/Caches/pip