ls: 无法访问 '/usr/local/python/cv2/python-3.6': 没有那个文件或目录

ls: cannot access '/usr/local/python/cv2/python-3.6': No such file or directory

我正在尝试按照教程安装 opencv - https://www.pyimagesearch.com/2018/05/28/ubuntu-18-04-how-to-install-opencv/

我一直坚持到 'make -j4' 并 100% 编译。

在这一步之后,当我尝试 ls /usr/local/python/cv2/python-3.6 时,出现以下错误 - ls: 无法访问 '/usr/local/python/cv2/python-3.6': 没有那个文件或目录

cd /usr/local/python/cv2
ls -l

共 16 个
-rw-r--r-- 1 root root 98 Jul 3 13:55 config.py
-rw-r--r-- 1 root root 2857 2018 年 11 月 17 日 init.py
-rw-r--r-- 1 root root 151 2018 年 11 月 17 日 load_config_py2.py
-rw-r--r-- 1 root root 262 2018 年 11 月 17 日 load_config_py3.py

哪个python
/home/ciaran/.virtualenvs/cv/bin/python

我已经查看了多个在线论坛并尝试了故障排除,但我仍然无法通过这一步。

出现错误是因为python 没有设置在你的路径中,所以你的系统不知道python 在哪里。 运行 在您的终端中执行以下命令,它应该会修复它:

export PATH="$PATH:/usr/local/bin/python"

解决了这个问题。

"If your compile chokes and hangs, it may be due to a threading race condition. In the event you run into this problem, simply delete your build directory, recreate it, and re-run cmake and make . This time do not include the flag next to make."

在教程中使用 $ make 代替 $ make -j4。

与 Python 3.6 有同样的问题,设法使用 GUI 中的搜索工具找到该文件。

我的在:

/usr/local/lib/python3.6/site-packages/cv2/python-3.6/

命名为cv2.cpython-36m-aarch64-linux-gnu.so

然后就可以正常工作了