Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 758
skiman01 Avatar asked Jun 30 '14 05:06

skiman01


3 Answers

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.

like image 181
James Mills Avatar answered Oct 07 '22 21:10

James Mills


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
like image 20
Carr Avatar answered Oct 07 '22 20:10

Carr


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.

like image 20
elarcoiris Avatar answered Oct 07 '22 20:10

elarcoiris