1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

RealSenseをPythonから使う時のインストール方法(pyenv編)

Posted at

RealSenseを使う際にこのリンクを参照すれば大体うまくいくんですが、pyenvを用いているとちょっとひと手間必要だったので、その時のメモ書きです

image.png
これで万事うまくいくと思ったんですが sudo make install で入る先はpyenvの各バージョンのフォルダではないので、pyenvで切り替えられた環境では、 pyrealsense2 などのモジュールは参照されません。
そのため、pyenvに pyrealsense2 などのモジュールを認識させる必要があります。

sudo make install時にインストール先が出力されるのでチェックします。
image.png
自分の環境だとこんな感じ

-- Up-to-date: /usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyrealsense2/pybackend2.2.38.1.cpython-37m-darwin.so
-- Up-to-date: /usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyrealsense2/pybackend2.2.cpython-37m-darwin.so
-- Up-to-date: /usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyrealsense2/pybackend2.cpython-37m-darwin.so
-- Installing: /usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyrealsense2/pyrealsense2.2.38.1.cpython-37m-darwin.so
-- Up-to-date: /usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyrealsense2/pyrealsense2.2.38.cpython-37m-darwin.so
-- Up-to-date: /usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyrealsense2/pyrealsense2.cpython-37m-darwin.so

一番Stableなのは

-- Up-to-date: /usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyrealsense2/pybackend2.cpython-37m-darwin.so
-- Up-to-date: /usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyrealsense2/pyrealsense2.cpython-37m-darwin.so

でしょうからこいつらをLinkします。
自分の環境の場合Brew経由でInstallしたので、下記のような感じでした。(それぞれでお使いのpyenvのフォルダへどうぞ)

$ cd /usr/local/var/pyenv/versions/3.7.7/lib/python3.7/site-packages
$ ln -s /usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyrealsense2/pyrealsense2.cpython-37m-darwin.so pyrealsense2.so
$ ln -s /usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyrealsense2/pybackend2.cpython-37m-darwin.so pybackend2.so

これを各versionのフォルダで行っていけばOKです

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?