我在我的Mac上安装了structure(list(HireDate = structure(c(17702, 13242, 16895, 17167,
12335, 13879, 12303, 13745, 14789, 16785, 15390, 17167, 12886,
13472, 15569, 13796, 16811, 11484, 13062, 17592, 16113, 13437,
15614, 17167, 17167, 16251, 17623, 13312, 14165, 17167, 17167,
10695, 15764, 13749, 16801, 17167, 13594, 13874, 17167, 17167,
13157, 17167, 12501, 13243, 12192, 12287, 12965, 13328, 17167,
13343, 17167, 17167, 11839, 17167, 13262, 13326, 14124, 16161,
17167, 17226, 12786, 13823, 13822, 13255, 17704, 17653, 12258,
12769, 13727, 10712, 17400, 13952, 14048, 14333, 17233, 17690,
13108, 13383, 13517, 13829, 17213, 13696, 16741, 17167, 17241,
12198, 14018, 12902, 16801, 17167, 17591, 12843, 13627, 14553,
15593, 16097, 16801, 13075, 13529, 17167), class = "Date"), TermDate = structure(c(NA,
13439, 17712, NA, 12880, 15408, 12877, 16493, 17135, 16944, 17135,
NA, 14054, 15670, 17531, 14327, NA, 13889, NA, NA, 16741, 17135,
17620, 17620, 17354, 17316, NA, 13312, 17166, NA, NA, 15705,
NA, 15112, NA, NA, 15705, 13970, 17655, NA, 13612, NA, 15418,
15917, 15705, NA, 14274, 13449, NA, 13559, 17417, NA, 14400,
NA, NA, 14334, 14813, 16343, 17703, NA, 12824, 15711, 15411,
14484, NA, NA, NA, 15309, 16493, 17197, NA, 14911, 16957, 15882,
NA, NA, 14435, 13768, 13517, 14907, NA, 17284, NA, NA, NA, 12772,
17166, NA, 16881, 17439, NA, 14944, NA, 15028, 16581, 16778,
NA, 13788, 14064, 17620), class = "Date")), row.names = 14296:14395, class = "data.frame")
,该Mac几个月前可以正常工作,但现在无法正常工作了。
我有以下特点。 -OpenCV:3.4.3.1 -操作系统/平台:macOS 10.14 -Python 3.6.5
我尝试在使用opencv的地方重新加载opencv
。但是,我收到以下错误消息:
python script
然后,我尝试使用this site的分步说明重新安装opencv,这是我第一次成功安装opencv。
写了Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/anaconda3/lib/python3.6/site-packages/cv2.so, 2): Library not loaded: /usr/local/opt/ilmbase/lib/libImath-2_2.12.dylib
Referenced from: /usr/local/Cellar/opencv/3.4.1_4/lib/libopencv_imgcodecs.3.4.dylib
Reason: image not found
和cd /usr/local/Cellar/opencv
之后,我得到:ls
。因此,我得出结论,我的计算机上的最新版本是3.4.1_4 3.4.3 3.4.3_1
3.4.3_1
然后,如果我执行以下/usr/local/Cellar/opencv/3.4.3_1/cv2.cpython-37m-darwin.so
和$ cd /usr/local/Cellar/opencv/3.4.3_1
,我将会得到$ cd lib
。
然后,我执行以下操作:
python3.7
,然后依次是$ cd python3.7
和$ cd site-packages
,我得到:$ pwd
我输入/usr/local/Cellar/opencv/3.4.3_1/lib/python3.7/site-packages
然后输入python并得到
$ python3
第1个问题,它说版本Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 03:03:55)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
和opencv似乎有一个lib 3.6.5
(而没有3.7
)是不是很奇怪? / p>
键入3.6
,然后键入>>> import sys
,并获得以下列表:
>>> print(sys.path)
然后输入:
['', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip',
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6',
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload',
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages']
然后添加以下命令:
$ ln -s /usr/local/Cellar/opencv/3.4.3_1/lib/python3.7/site-packages/cv2.cpython-37m-darwin.so /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cv2.so
此后,应完成安装。但是我仍然收到相同的错误消息
我该怎么办?
答案 0 :(得分:0)
实际上opencv
已成功安装。
我实际上必须更改jupyter内核的Path
文件中的.json
。首先,我检查了jupyter内核列表:
$ jupyter kernelspec list
julia-0.6 /Users/mymac/Library/Jupyter/kernels/julia-0.6
julia-1.0 /Users/mymac/Library/Jupyter/kernels/julia-1.0
python3 /Users/mymac/Library/Jupyter/kernels/python3
然后我cd
在上面的python路径中,我在里面找到文件kernel.json
并打开了它:
{
"argv": [
"/path/to/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "Python 3",
"language": "python"
}
然后在该文件中,通过在终端中键入以下内容时获得的python路径更改行/path/to/python
:
$ which python
/Users/mymac/anaconda3/bin/python
重新启动Atom
,终于成功了!
github page of jupyter的提示也有很大帮助!