<p>我认为最简单和最快的方法是通过.whl文件安装。@foobar在post@kyjanond链接中给出了答案,但是您可以从以下链接获取.whl文件。</p>
<p>打开简历:<a href="https://pypi.python.org/pypi/opencv-python/3.3.0.10" rel="nofollow noreferrer">https://pypi.python.org/pypi/opencv-python/3.3.0.10</a></p>
<p>OpenCV贡献:<a href="https://pypi.python.org/pypi/opencv-contrib-python/3.3.0.10" rel="nofollow noreferrer">https://pypi.python.org/pypi/opencv-contrib-python/3.3.0.10</a></p>
<p>我在Python2.7上安装了OpenCV3.3.0,所以我下载了:</p>
<ul>
<li>opencv_python-3.3.0.10-cp27-cp27m-win32.whl</li>
<li>opencv_contrib_python-3.3.0.10-cp27-cp27m-win32.whl</li>
</ul>
<p>要安装,我运行了:</p>
<ul>
<li>python-m pip安装opencv_python-3.3.0.10-cp27-cp27m-win32.whl</li>
<li>python-m pip安装opencv_contrib_python-3.3.0.10-cp27-cp27m-win32.whl</li>
</ul>
<p>这是可行的,但是在OpenCV的更新版本中,tracker函数的调用方式已经改变。</p>
<p>GitHub存储库中的原始代码是:</p>
<hr/>
<pre><code>tracker_types = ['BOOSTING', 'MIL','KCF', 'TLD', 'MEDIANFLOW', 'GOTURN']
tracker_type = tracker_types[1]
tracker = cv2.Tracker_create(tracker_type)
</code></pre>
<hr/>
<p>我把这个改成了</p>
<hr/>
<pre><code>tracker_types = ['BOOSTING', 'MIL','KCF', 'TLD', 'MEDIANFLOW', 'GOTURN']
tracker_type = tracker_types[1]
if tracker_type == tracker_types[0]:
tracker = cv2.TrackerBoosting_create()
elif tracker_type == tracker_types[1]:
tracker = cv2.TrackerMIL_create()
elif tracker_type == tracker_types[2]:
tracker = cv2.TrackerKCF_create()
elif tracker_type == tracker_types[3]:
tracker = cv2.TrackerTLD_create()
elif tracker_type == tracker_types[4]:
tracker = cv2.TrackerMedianFlow_create()
elif tracker_type == tracker_types[5]:
tracker = cv2.TrackerGOTURN_create()
</code></pre>
<hr/>
<p>这种方法似乎对我很有效。</p>