Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to install pip: Permission denied error

I am trying to install pip but currently unable to. I navigate to the pip folder and

python setup.py install

Everything seems to go fine until the very end:

Extracting pip-0.8.2-py2.6.egg to /Library/Python/2.6/site-packages
Adding pip 0.8.2 to easy-install.pth file
Installing pip script to /usr/local/bin
error: /usr/local/bin/pip: Permission denied

I've also tried easy_install . and attempted to refer to the related thread with no luck: Python install uninstall easy_install

Any ideas?

like image 447
Eitan Avatar asked Dec 05 '10 16:12

Eitan


People also ask

How do I run pip with admin rights?

Right click on command prompt shortcut and choose "Run as Administrator". Then run the following command. Same for me - it just needed to run cmd as administrator.

How do you do pip install using CMD?

Step 1: Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed. Step 2: Change the current path of the directory in the command line to the path of the directory where the above file exists. Step 4: Now wait through the installation process.

How do I manually install pip in Python?

Ensure you can run pip from the command lineRun python get-pip.py . 2 This will install or upgrade pip. Additionally, it will install setuptools and wheel if they're not installed already.


1 Answers

Looks like you're on an Linux/Unix box and you're not root ... which means you don't have permission to put things in /usr/local/bin (or a lot of other places).

Update for comments:

Since OS X is (under the hood) FreeBSD Unix, there is still the basic concept of 'root'. Your admin account is capable of doing root-type things, but it doesn't automatically escalate privileges (which is a Good Thing). The command you are looking for is sudo, which provides temporary root privileges. To do it for a single command (the most normal case), simply prefix the command with sudo, e.g. sudo python setup.py install. You will probably be prompted to supply your password again (not root's password, but your own) and then the command will be executed. sudo will only prompt you the first time (or every N minutes) for a password.

I noted here that in 10.5 and later, sudo will only work if your admin account has a password. If it doesn't, then you will have to set one before this will work.

If you have a whole bunch of stuff you need to do as root, try sudo /bin/bash (or you shell of choice), which will give you a new shell (as a child process of the other shell) which has full root privileges. Note Well: if you are not use to living at a root-prompt, this is not a great idea. One slip of the keyboard and you can nail your system to the outhouse wall. So be careful out there!

like image 109
Peter Rowell Avatar answered Sep 22 '22 02:09

Peter Rowell