简体   繁体   中英

Cannot install pip for python3 on mac

When I run

curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python3 get-pip.py

It gives me this error:

Downloading/unpacking pip
  Cannot fetch index base URL https://pypi.python.org/simple/
  Could not find any downloads that satisfy the requirement pip
Cleaning up...
No distributions at all found for pip
Storing debug log for failure in /var/root/.pip/pip.log

However if I just run:

sudo python get-pip.py

There is no problem:

Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-1.5.2-py2.py3-none-any.whl#md5=445a893564065937c0f31ac2cc8e2f35
  Downloading pip-1.5.2-py2.py3-none-any.whl (1.2MB): 1.2MB downloaded
Installing collected packages: pip
  Found existing installation: pip 1.5.1
    Uninstalling pip:
      Successfully uninstalled pip
Successfully installed pip
Cleaning up...

Can anyone help please? Thanks!

This is a simple permissions issue. If you're installing to the system Python installation, you should need root, which is what sudo provides.

If you need to install stuff where you don't have root privileges, you need to look into Python virtual environments .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM