0

I'm trying to install OpenCV on my Mac (OS X 10.11.3) using this tutorial because it uses a VirtualEnv, which is a way to ensure consistency in development.

I skipped Steps 1&2 since I already have Xcode and Homebrew. Step 3 worked well (after updating ~/.bash_profile as instructed):

User:~ user$ brew update
Already up-to-date.
User:~ user$ source ~/.bash_profile
User:~ user$ which python
/usr/local/bin/python
User:~ user$ 

The trouble is in Step 4:

User:~ user$ pip install virtualenv virtualenvwrapper
-bash: /usr/local/bin/pip: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory
User:~ user$

This is probably because I'm in the local bin due to adding this to ~/.bash_profile from Step 3:

# Homebrew
export PATH=/usr/local/bin:$PATH

This basically means I can't access pip from that location, but when I try to install it locally (with the above lines added in ~/.bash_profile), it says:

User:~ user$ brew install pip
Error: No available formula with the name "pip" 
Homebrew provides pip via: `brew install python`. However you will then
have two Pythons installed on your Mac, so alternatively you can install
pip via the instructions at:

  https://pip.readthedocs.org/en/stable/installing/#install-pip
User:~ user$

How can I access pip with my updated ~/.bash_profile from Step 3? Thanks!

sean
  • 3,484
  • 5
  • 27
  • 45

1 Answers1

0

Ok, I figured out the problem.

I was getting the same errors as this stackoverflow question, so I ran the recommended

brew link python

which encountered the same errors as this stackoverflow question, so I ran the recommended

brew link --overwrite python

which seemed to correct the problem and allows me to run pip while accessing Homebrew packages first.

Community
  • 1
  • 1
sean
  • 3,484
  • 5
  • 27
  • 45