Mac brought python2.6 and python2.7, their own this time and installed the python3.6 (already configured environment variables), all of a sudden by the three version of the Python path dizzy. The path to the three versions is as follows: The path to python2.6 is:/system/library/frameworks/python.framework/versions/2.6 python2.7 path is:/system The/library/frameworks/python.framework/versions/2.7 python3.6 path is:/library/frameworks/python.framework/versions/ 3.6
two ways to view the Python path (for example, python3.6): which python3.6 uses Python's sys library
Import sys
print (sys.path)
HomeBrew, pyenv, OpenCV matters of concernHomebrew installed Third-party packages download OpenCV's dependent libraries (Numpy,python2) in the/usr/local/cellar/directory when brew install OPENCV homebrew Python2.7/site-packages directory to establish cv2.so->/usr/local/cellar/opencv/3.3.0_3/lib/python2.7/site-packages/soft Links To identify OpenCV in the import module, you need to do the following:
Mkdir-p/users/weisuzhong/.local/lib/python2.7/site-packages Echo ' import site; Site.addsitedir ("/usr/local/lib/python2.7/site-packages") ' >>/users/weisuzhong/.local/lib/python2.7/ Site-packages/homebrew.pth
Of course, this is a third-party library installation path (PIP) system that is based on the homebrew installation OpenCV. Python:/system/library/frameworks/python.framework/ Versions/2.7/extras/lib/python/pyenv-installed Python:/users/weisuzhong/.pyenv/versions/2.7.10/lib/python2.7/ site-packages/
The best way to know the installation of a version of Python and the location of a Third-party library is to use the pycharm!