简体   繁体   中英

error when trying to install pip on mac 10.7

I am trying to download pip onto my mac by following the instructions on the pip installation guide and I am coming up with this error after running the following command

$python get-pip.py

/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/
MacOS/Python: can't open file 'get-pip.py': [Errno 2] No such file or directory

This is happening after I download the 'get-pip.py' doc as the instructions suggest. Do I need to put this file in a certain location before I continue? I am relatively new to downloading programs through the terminal.

Thanks for the help!

It is recommended ( highly ) that you NOT use the version of Python that ships with your Mac. Instead use HomeBrew and install a "custom" version of Python ( usually the latest ). Then proceed to use virtualenv and optionally virtualenvwrapper

Prerequisites:

  1. First, install Xcode from the App Store ( it's FREE ).

Install HomeBrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Install Python:

brew install python

This will install pip for you as well in /usr/local/bin/ .

Install virtualenv:

pip install virtualenv

virtualenv Basic Usage:

virtualenv /path/to/my/env
cd /path/to/my/env
source ./bin/activate

# hack on your python project
deactivate  # to go back to your normal shell

Please follow instructions for virtualenv for more details.

virtualenvwrapper is also really convenient and worthwhile learning.

None of the above solutions worked for me, so I decided to straight out clean install Python 3.6 from the downloads page at python.org .

After you have completed the Python installer, go into Terminal and type in:

curl -O https://bootstrap.pypa.io/get-pip.py

Wait for the download to complete and then type in:

python3 get-pip.py --user

Then for your pip commands you will use 'pip3'. For example:

pip3 install awsebcli --upgrade --user

After python and pip have been installed they should be in your user Library. So update your PATH in terminal like so:

export PATH=~/Library/Python/3.6/bin:$PATH

I have a bash_profile shell so I also ran the following command in terminal to load script into my current session:

source ~/.bash_profile

After this, verify that your pip installed component was successful. For example:

eb --version

See AWS for the above reference.

Update :

More explanation at @dval 's comment

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

and then execute

$ python get-pip.py

Curl did not work for me. I had to use "wget".

$ wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py

and then execute

$ python get-pip.py

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