Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade permission denied: how to upgrade pip on Mac OS X? [closed]

Tags:

python

macos

pip

I'm new to Mac OS X. I want to set up an environment for python programming. I'm using pip to manage the third party packages.

I installed pip with easy_install.

sudo easy_install pip

I tried to upgrade pip from 6.1.0 to 6.1.1. However, my request was declined and I got the following message.

$ pip install --upgrade pip
You are using pip version 6.1.0, however version 6.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip
Using cached pip-6.1.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 6.1.0
Uninstalling pip-6.1.0:
  Successfully uninstalled pip-6.1.0
Rolling back uninstall of pip
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pip-6.1.0-py2.7.egg/pip/basecommand.py", line 246, in main
  status = self.run(options, args)
File "/usr/local/lib/python2.7/site-packages/pip-6.1.0-py2.7.egg/pip/commands/install.py", line 352, in run
  root=options.root_path,
File "/usr/local/lib/python2.7/site-packages/pip-6.1.0-py2.7.egg/pip/req/req_set.py", line 711, in install
  **kwargs
File "/usr/local/lib/python2.7/site-packages/pip-6.1.0-py2.7.egg/pip/req/req_install.py", line 806, in install
  self.move_wheel_files(self.source_dir, root=root)
File "/usr/local/lib/python2.7/site-packages/pip-6.1.0-py2.7.egg/pip/req/req_install.py", line 1007, in move_wheel_files
  isolated=self.isolated,
File "/usr/local/lib/python2.7/site-packages/pip-6.1.0-py2.7.egg/pip/wheel.py", line 347, in move_wheel_files
  generated.extend(maker.make(spec))
File "/usr/local/lib/python2.7/site-packages/pip-6.1.0-py2.7.egg/pip/_vendor/distlib/scripts.py", line 323, in make
  self._make_script(entry, filenames, options=options)
File "/usr/local/lib/python2.7/site-packages/pip-6.1.0-py2.7.egg/pip/_vendor/distlib/scripts.py", line 227, in _make_script
  self._write_script(scriptnames, shebang, script, filenames, ext)
File "/usr/local/lib/python2.7/site-packages/pip-6.1.0-py2.7.egg/pip/_vendor/distlib/scripts.py", line 201, in _write_script
  self._fileop.write_binary_file(outname, script_bytes)
File "/usr/local/lib/python2.7/site-packages/pip-6.1.0-py2.7.egg/pip/_vendor/distlib/util.py", line 388, in write_binary_file
  with open(path, 'wb') as f:
IOError: [Errno 13] Permission denied: '/usr/local/bin/pip'

It seems I don't have the permission to upgrade pip. I think this isn't a problem of lack of dependent packages. The OS X system I'm using is OS X 10.10.3. And I'm using Python 2.7.9.

Could someone help me solve this problem?

like image 225
Wang Zong'an Avatar asked May 01 '15 06:05

Wang Zong'an


People also ask

How do I update pip permission denied?

If you are attempting to install or upgrade packages using "pip install" in a workspace, then you may receive a permission denied error. It's possible to install/upgrade packages in a workspace session, but you need to include the --user flag to avoid the permissions error.

How can I upgrade my pip version?

You can update pip using pip without any hassle. When an update for pip is available, and you run a pip command, you will see a message that says, “You are using pip version xy. a, however version xy. b is available.” You can run “pip install --upgrade pip” to install and use the new version of pip.

Can't install packages due to an EnvironmentError Permission denied record?

The error "Could not install packages due to an EnvironmentError: [Errno 13] Permission denied" is often caused because the user doesn't have access to modify the directory where the package should be installed. To solve the error, allow the user full access to the Python directory.


1 Answers

You installed it with sudo easy_install pip, which makes the pip created by root user.

When upgrading it, you should also use:

sudo pip install --upgrade pip
like image 142
skyline75489 Avatar answered Sep 30 '22 05:09

skyline75489