我无法安装Open CV

时间:2019-12-20 10:08:02

标签: python machine-learning conv-neural-network cv2

我正在尝试为本教程安装Open CV ... https://www.youtube.com/watch?v=Hqf__FlRlzg&list=WL&index=4&t=2494s 我已经安装了它,当我在终端中输入pip list时,它表明我已经安装了它

pip list
Package                                Version   
-------------------------------------- ----------
absl-py                                0.8.1     
alabaster                              0.7.12    
anaconda-client                        1.7.2     
anaconda-navigator                     1.9.7     
anaconda-project                       0.8.3     
appnope                                0.1.0     
appscript                              1.0.1     
asn1crypto                             0.24.0    
astor                                  0.8.0     
astroid                                2.2.5     
astropy                                3.2.1     
atomicwrites                           1.3.0     
attrs                                  19.1.0    
Babel                                  2.7.0     
backcall                               0.1.0     
backports.functools-lru-cache          1.5       
backports.os                           0.1.1     
backports.shutil-get-terminal-size     1.0.0     
backports.tempfile                     1.0       
backports.weakref                      1.0.post1 
beautifulsoup4                         4.7.1     
bitarray                               0.9.3     
bkcharts                               0.2       
bleach                                 3.1.0     
bokeh                                  1.2.0     
boto                                   2.49.0    
Bottleneck                             1.2.1     
certifi                                2019.11.28
cffi                                   1.12.3    
chardet                                3.0.4     
Click                                  7.0       
cloudpickle                            1.2.1     
clyent                                 1.2.2     
colorama                               0.4.1     
conda                                  4.8.0     
conda-build                            3.18.8    
conda-package-handling                 1.3.11    
conda-verify                           3.4.2     
contextlib2                            0.5.5     
cryptography                           2.7       
cycler                                 0.10.0    
Cython                                 0.29.12   
cytoolz                                0.10.0    
dask                                   2.1.0     
decorator                              4.4.0     
defusedxml                             0.6.0     
distributed                            2.1.0     
docutils                               0.14      
entrypoints                            0.3       
et-xmlfile                             1.0.1     
fastcache                              1.1.0     
filelock                               3.0.12    
Flask                                  1.1.1     
future                                 0.17.1    
gast                                   0.3.2     
gevent                                 1.4.0     
glob2                                  0.7       
gmpy2                                  2.0.8     
greenlet                               0.4.15    
grpcio                                 1.16.1    
h5py                                   2.9.0     
heapdict                               1.0.0     
html5lib                               1.0.1     
idna                                   2.8       
imageio                                2.5.0     
imagesize                              1.1.0     
importlib-metadata                     0.17      
ipykernel                              5.1.1     
ipython                                7.6.1     
ipython-genutils                       0.2.0     
ipywidgets                             7.5.0     
isort                                  4.3.21    
itsdangerous                           1.1.0     
jdcal                                  1.4.1     
jedi                                   0.13.3    
Jinja2                                 2.10.1    
joblib                                 0.13.2    
json5                                  0.8.4     
jsonschema                             3.0.1     
jupyter                                1.0.0     
jupyter-client                         5.3.1     
jupyter-console                        6.0.0     
jupyter-core                           4.5.0     
jupyterlab                             1.0.2     
jupyterlab-server                      1.0.0     
Keras-Applications                     1.0.8     
Keras-Preprocessing                    1.1.0     
keyring                                18.0.0    
kiwisolver                             1.1.0     
lazy-object-proxy                      1.4.1     
libarchive-c                           2.8       
lief                                   0.9.0     
llvmlite                               0.29.0    
locket                                 0.2.0     
lxml                                   4.3.4     
Markdown                               3.1.1     
MarkupSafe                             1.1.1     
matplotlib                             3.1.0     
mccabe                                 0.6.1     
mistune                                0.8.4     
mkl-fft                                1.0.12    
mkl-random                             1.0.2     
mkl-service                            2.0.2     
mock                                   3.0.5     
more-itertools                         7.0.0     
MouseInfo                              0.1.2     
mpmath                                 1.1.0     
msgpack                                0.6.1     
multipledispatch                       0.6.0     
navigator-updater                      0.2.1     
nbconvert                              5.5.0     
nbformat                               4.4.0     
networkx                               2.3       
nltk                                   3.4.4     
nose                                   1.3.7     
notebook                               6.0.0     
numba                                  0.44.1    
numexpr                                2.6.9     
numpy                                  1.16.4    
numpydoc                               0.9.1     
olefile                                0.46      
opencv-python                          4.1.2.30  
openpyxl                               2.6.2     
packaging                              19.0      
pandas                                 0.24.2    
pandocfilters                          1.4.2     
parso                                  0.5.0     
partd                                  1.0.0     
path.py                                12.0.1    
pathlib2                               2.3.4     
patsy                                  0.5.1     
pep8                                   1.7.1     
pexpect                                4.7.0     
pickleshare                            0.7.5     
Pillow                                 6.1.0     
pip                                    19.3.1    
pkginfo                                1.5.0.1   
pluggy                                 0.12.0    
ply                                    3.11      
prometheus-client                      0.7.1     
prompt-toolkit                         2.0.9     
protobuf                               3.11.2    
psutil                                 5.6.3     
ptyprocess                             0.6.0     
py                                     1.8.0     
PyAutoGUI                              0.9.48    
pycodestyle                            2.5.0     
pycosat                                0.6.3     
pycparser                              2.19      
pycrypto                               2.6.1     
pycurl                                 7.43.0.3  
pyflakes                               2.1.1     
pygame                                 1.9.6     
PyGetWindow                            0.0.8     
Pygments                               2.4.2     
pylint                                 2.3.1     
PyMsgBox                               1.0.7     
pyobjc                                 6.1       
pyobjc-core                            6.1       
pyobjc-framework-Accounts              6.1       
pyobjc-framework-AddressBook           6.1       
pyobjc-framework-AppleScriptKit        6.1       
pyobjc-framework-AppleScriptObjC       6.1       
pyobjc-framework-ApplicationServices   6.1       
pyobjc-framework-Automator             6.1       
pyobjc-framework-AVFoundation          6.1       
pyobjc-framework-AVKit                 6.1       
pyobjc-framework-CalendarStore         6.1       
pyobjc-framework-CFNetwork             6.1       
pyobjc-framework-CloudKit              6.1       
pyobjc-framework-Cocoa                 6.1       
pyobjc-framework-Collaboration         6.1       
pyobjc-framework-CoreAudio             6.1       
pyobjc-framework-CoreAudioKit          6.1       
pyobjc-framework-CoreBluetooth         6.1       
pyobjc-framework-CoreData              6.1       
pyobjc-framework-CoreLocation          6.1       
pyobjc-framework-CoreMedia             6.1       
pyobjc-framework-CoreMediaIO           6.1       
pyobjc-framework-CoreServices          6.1       
pyobjc-framework-CoreText              6.1       
pyobjc-framework-CoreWLAN              6.1       
pyobjc-framework-CryptoTokenKit        6.1       
pyobjc-framework-DictionaryServices    6.1       
pyobjc-framework-DiscRecording         6.1       
pyobjc-framework-DiscRecordingUI       6.1       
pyobjc-framework-DiskArbitration       6.1       
pyobjc-framework-DVDPlayback           6.1       
pyobjc-framework-EventKit              6.1       
pyobjc-framework-ExceptionHandling     6.1       
pyobjc-framework-FinderSync            6.1       
pyobjc-framework-FSEvents              6.1       
pyobjc-framework-GameCenter            6.1       
pyobjc-framework-GameController        6.1       
pyobjc-framework-GameKit               6.1       
pyobjc-framework-ImageCaptureCore      6.1       
pyobjc-framework-IMServicePlugIn       6.1       
pyobjc-framework-InputMethodKit        6.1       
pyobjc-framework-InstallerPlugins      6.1       
pyobjc-framework-InstantMessage        6.1       
pyobjc-framework-IOSurface             6.1       
pyobjc-framework-iTunesLibrary         6.1       
pyobjc-framework-LatentSemanticMapping 6.1       
pyobjc-framework-LaunchServices        6.1       
pyobjc-framework-libdispatch           6.1       
pyobjc-framework-LocalAuthentication   6.1       
pyobjc-framework-MapKit                6.1       
pyobjc-framework-MediaAccessibility    6.1       
pyobjc-framework-MediaLibrary          6.1       
pyobjc-framework-MediaToolbox          6.1       
pyobjc-framework-MultipeerConnectivity 6.1       
pyobjc-framework-NetFS                 6.1       
pyobjc-framework-NotificationCenter    6.1       
pyobjc-framework-OpenDirectory         6.1       
pyobjc-framework-OSAKit                6.1       
pyobjc-framework-PreferencePanes       6.1       
pyobjc-framework-PubSub                6.1       
pyobjc-framework-QTKit                 6.1       
pyobjc-framework-Quartz                6.1       
pyobjc-framework-SceneKit              6.1       
pyobjc-framework-ScreenSaver           6.1       
pyobjc-framework-ScriptingBridge       6.1       
pyobjc-framework-SearchKit             6.1       
pyobjc-framework-Security              6.1       
pyobjc-framework-SecurityFoundation    6.1       
pyobjc-framework-SecurityInterface     6.1       
pyobjc-framework-ServiceManagement     6.1       
pyobjc-framework-Social                6.1       
pyobjc-framework-SpriteKit             6.1       
pyobjc-framework-StoreKit              6.1       
pyobjc-framework-SyncServices          6.1       
pyobjc-framework-SystemConfiguration   6.1       
pyobjc-framework-VideoToolbox          6.1       
pyobjc-framework-WebKit                6.1       
pyodbc                                 4.0.26    
pyOpenSSL                              19.0.0    
pyparsing                              2.4.0     
pyperclip                              1.7.0     
PyRect                                 0.1.4     
pyrsistent                             0.14.11   
PyScreeze                              0.1.25    
PySocks                                1.7.0     
pytest                                 5.0.1     
pytest-arraydiff                       0.3       
pytest-astropy                         0.5.0     
pytest-doctestplus                     0.3.0     
pytest-openfiles                       0.3.2     
pytest-remotedata                      0.3.1     
python-dateutil                        2.8.0     
PyTweening                             1.0.3     
pytz                                   2019.1    
PyWavelets                             1.0.3     
PyYAML                                 5.1.1     
pyzmq                                  18.0.0    
QtAwesome                              0.5.7     
qtconsole                              4.5.1     
QtPy                                   1.8.0     
requests                               2.22.0    
rope                                   0.14.0    
ruamel-yaml                            0.15.46   
scikit-image                           0.15.0    
scikit-learn                           0.21.2    
scipy                                  1.3.0     
seaborn                                0.9.0     
Send2Trash                             1.5.0     
setuptools                             41.0.1    
simplegeneric                          0.8.1     
singledispatch                         3.4.0.3   
six                                    1.12.0    
sklearn                                0.0       
snowballstemmer                        1.9.0     
sortedcollections                      1.1.2     
sortedcontainers                       2.1.0     
soupsieve                              1.8       
Sphinx                                 2.1.2     
sphinxcontrib-applehelp                1.0.1     
sphinxcontrib-devhelp                  1.0.1     
sphinxcontrib-htmlhelp                 1.0.2     
sphinxcontrib-jsmath                   1.0.1     
sphinxcontrib-qthelp                   1.0.2     
sphinxcontrib-serializinghtml          1.1.3     
sphinxcontrib-websupport               1.1.2     
spyder                                 3.3.6     
spyder-kernels                         0.5.1     
SQLAlchemy                             1.3.5     
statsmodels                            0.10.0    
sympy                                  1.4       
tables                                 3.5.2     
tblib                                  1.4.0     
tensorboard                            1.14.0    
tensorflow                             1.14.0    
tensorflow-estimator                   1.14.0    
termcolor                              1.1.0     
terminado                              0.8.2     
testpath                               0.4.2     
tflearn                                0.3.2     
toolz                                  0.10.0    
tornado                                6.0.3     
tqdm                                   4.32.1    
traitlets                              4.3.2     
unicodecsv                             0.14.1    
urllib3                                1.24.2    
wcwidth                                0.1.7     
webencodings                           0.5.1     
Werkzeug                               0.15.4    
wheel                                  0.33.4    
widgetsnbextension                     3.5.0     
wrapt                                  1.11.2    
wurlitzer                              1.0.2     
xlrd                                   1.2.0     
XlsxWriter                             1.1.8     
xlwings                                0.15.8    
xlwt                                   1.3.0     
zict                                   1.0.0     
zipp                                   0.5.1   

如果您查看O部分,则会看到opencv-python,但是在我的项目中,当我尝试使用它导入

import cv2

它不起作用,并显示此错误消息...

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cv2/__init__.py", line 3, in <module>
    from .cv2 import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cv2/cv2.cpython-38-darwin.so, 2): Symbol not found: _clock_gettime
  Referenced from: /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cv2/.dylibs/libavutil.56.31.100.dylib (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib
 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cv2/.dylibs/libavutil.56.31.100.dylib

我尝试了以下导入方法,但是似乎没有任何作用

import opencv
import cv4
import cv3
import cv
import opencv-python
etc...

任何帮助将不胜感激,并在此先感谢您

3 个答案:

答案 0 :(得分:0)

我相信您正在使用masOS。

这是最新的Pillow 5.1.0版本中的错误。

这是由于将Xcode从版本8升级到9.2来构建二进制车轮而引起的。

Capitan 10.11是Xcode 8的“最低运行macOS”。

Sierra 10.12.6是Xcode 9.2的最小值。

https://en.wikipedia.org/wiki/Xcode#Xcode_7.0_-9.x(since_Free_On-Device_Development

将在某个时候修复Pillow 5.1.1。

与此同时,解决方法是:pip install'pillow!= 5.1.0'

(或升级您的macOS,或从源代码构建。)

有关更多信息,请参见https://github.com/python-pillow/Pillow/issues/3068

答案 1 :(得分:0)

您显示一个pip list和一个堆栈跟踪,表明您正在使用Python 3.8。除非在MacOS上出现了奇怪的现象,否则您将需要使用pip3(而不是pip)来安装opencv-python。之后

import cv2

应该工作。

答案 2 :(得分:0)

显然,OpenCV 4.1.x不喜欢El Capitan ...将OpenCV降级到3.4.5.20

在所需的环境中:

pip install --force-reinstall opencv-contrib-python==3.4.5.20

其他:

sudo -H python3 -m pip install --force-reinstall opencv-contrib-python==3.4.5.20