I can't install PIP on MacOS Sierra

╄→尐↘猪︶ㄣ 提交于 2021-01-28 10:52:37

问题


I've been running Python 3 in Pycharm for a while now, and I tried to install a new module and it failed to install. Specifically it gave me a "Non-zero exit code (1)" and told me to attempt to install it from my terminal using PIP. I have since updated and reinstalled Pycharm and it still will not install new modules.

In the terminal, I attempted

pip --version

The response:

-bash: pip: command not found

I look up how to install PIP, and try:

sudo easy_install pip

This is what it said:

Searching for pip
Reading https://pypi.python.org/simple/pip/
Download error on https://pypi.python.org/simple/pip/: [SSL:
TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol   version 
(_ssl.c:590) -- Some packages may not be found!
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: [SSL:     
TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)
-- Some packages may not be found!
No local packages or download links found for pip
error: Could not find suitable distribution for     
Requirement.parse('pip')

So I go back to google and do a little more searching and find to try it without the sudo, so

easy_install pip

Then it gives me this:

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-2117.pth'

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://pythonhosted.org/setuptools/easy_install.html

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

so then I find this earlier question: Why is Python easy_install not working on my Mac?

I try:

sudo rm -f /usr/bin/easy_install*

and it gives me

rm: /usr/bin/easy_install: Operation not permitted
rm: /usr/bin/easy_install-2.6: Operation not permitted
rm: /usr/bin/easy_install-2.7: Operation not permitted

So then I find this old question: Installing pip on macOS does not work (anymore), which has 2 answers saying to just install homebrew. So I try that:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.comnn
/Homebrew/install/master/install)"

Homebrew installs, and I think I'm ready to go.

pip --version

-bash: pip: command not found

EDIT: I tried

echo $PATH

I had forgotten that I originally used Python through Anaconda and removed it, and that's probably what started this. Is there any way to fix this?


回答1:


For Mac OS Sierra, cannot install pip via easy_install

So install pip using curl as follows,

curl https://bootstrap.pypa.io/get-pip.py | sudo python



回答2:


Pip is already installed with Python , so if it is not working then you should try to reinstall python (the latest version) and then try checking if you have pip installed .If that doesn't work - then you should type this into the terminal - curl https://bootstrap.pypa.io/get-pip.py | sudo python . HTH (: . I tried re installing python and that worked for me ( I am also on a mac)



来源:https://stackoverflow.com/questions/50126234/i-cant-install-pip-on-macos-sierra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!