Wrong PYTHONPATH after updating .bash_profile for Mac

asked 2012-09-20 09:01:14 -0500

uqarni gravatar image

updated 2012-09-20 17:51:31 -0500

Hello there,

Total noob here trying to get OpenCV working on Python through Homebrew. I searched everywhere extensively and couldn't find an answer intelligible to me. 99% of what I have done for this install is blindly follow forum posts, though I am beginning to get an understanding of what all this means.
Installed software:

OS 10.7.4
Xcode 4.4.1
-Command Line Tools
HomeBrew
-Python
-GFortran
-OpenCV

1. write this on first line of .bash_profile and save and restart Mac
export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"

2. open IDLE located at /usr/local/Cellar/python/2.7.3
.>>> import cv

Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import cv
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cv.py", line 1, in <module>
ImportError: No module named cv2.cv

3. Go to Terminal to check PATH and PYTHONPATH
myname-MacBook-Pro:~ myname$ set
.#edited out unnecessary lines PATH=/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin PYTHONPATH=/usr/local/lib/python2.7/site-packages:

1) What does my PATH need to be? I know its comically out of whack from repeated attempts.
2) Why isnt IDLE using this PYTHONPATH?

3. And most importantly, WHAT DO I NEED TO DO OVERALL TO JUST GET AN ICON, ON MY DOCK, THAT I CAN CLICK, THAT OPENS A PROGRAM, WHERE I CAN CODE WONDERFUL PYTHON WITH MAGNIFICENT OPENCV.

Thank you very much for any help you can send my way. I have been attempting to solve this problem for the last 3 days and would be very very appreciative of any help.

edit retag flag offensive close merge delete

Comments

I had similar problems with PythonPath and was unable to find a solution. Ended up switching to Windows. I would also appreciate a response.

peon1990 gravatar imagepeon1990 ( 2012-09-20 18:02:12 -0500 )edit

Here is a really nice tutorial to help you with the install process http://www.pyimagesearch.com/2016/12/19/install-opencv-3-on-macos-with-homebrew-the-easy-way/ (http://www.pyimagesearch.com/2016/12/...)

naeluh gravatar imagenaeluh ( 2017-03-29 18:33:20 -0500 )edit

Hi i can't us SIFT and SURF function in opencv-python 3.4.3 Whait is problem for it ? tnk's

Nobu gravatar imageNobu ( 2018-10-17 04:31:17 -0500 )edit

@Nobu -- please don't post answers here, if you have a question or comment. thank you.

(also, responding to questions from 2012 is somewhat useless)

berak gravatar imageberak ( 2018-10-17 04:33:55 -0500 )edit