'Operation Not Permitted' on Mac Terminal when trying to install python packages

478 Views Asked by At

I'm trying to install a package on python with the following lines of code:

git clone https://github.com/dartoon/decomprofile
cd decomprofile
python setup.py develop

It goes well until the last step, which returns the error message:

error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-53720.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /Library/Python/2.7/site-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  https://setuptools.readthedocs.io/en/latest/easy_install.html

Please make the appropriate changes for your system and try again.

I'm administrator on my computer, so I don't know why I would not have permission to change the files. I've made sure that I have Full Disk Access, as well. I have tried the command

sudo easy_install

but that is also not working. I am on Mac OS Catalina working in Terminal app. I recently updated to anaconda3 and use Python 3.8, so I am unsure why the directory says 2.7-- can I delete this directory?

1

There are 1 best solutions below

1
n0nvme On BEST ANSWER

By default, macOS comes with python2.7 preinstalled. Catalina also comes with preinstalled python3.7. Try using python3 command instead of python.

You can't remove python 2.7 because it is system dependency.