LoginSignup
0
0

More than 1 year has passed since last update.

ROS(1)から呼ぶPythonはどこ?

Last updated at Posted at 2022-10-20

TL;DR

pyenvを入れていれば、pyenvのpython。すなわち、which pythonで取得されるpythonパス。
(基本的にpyenv入れないと僕は何もできないので、pyenv入っていない人はごめんなさい)

根拠をゆえ!()

$ rosrun mediapipe_ros app.py
[ERROR:0@0.785] global /io/opencv/modules/videoio/src/cap.cpp (164) open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.6.0) /io/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): /home/yuki/workspace/lidar_data/DATA_AOYAMA-suiyoubi/walk-senpai.mkv in function 'icvExtractPattern'


Downloading model to /home/yonelab/.pyenv/versions/3.9.0/lib/python3.9/site-packages/mediapipe/modules/objectron/object_detection_ssd_mobilenetv2_oidv4_fp16.tflite
Downloading model to /home/yonelab/.pyenv/versions/3.9.0/lib/python3.9/site-packages/mediapipe/modules/objectron/object_detection_3d_sneakers.tflite
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.

↑は、mediapipeのposeをpublishするパッケージをビルドした後、実行したときのエラーです。エラー内容は、動画ファイルを置き忘れていることによるものですが、大事なのはtfliteが保存される場所です。

Downloading model to /home/yonelab/.pyenv/versions/3.9.0/lib/python3.9/site-packages/mediapipe/modules/objectron/object_detection_ssd_mobilenetv2_oidv4_fp16.tflite
Downloading model to /home/yonelab/.pyenv/versions/3.9.0/lib/python3.9/site-packages/mediapipe/modules/objectron/object_detection_3d_sneakers.tflite

もちろん、これの前に、$ pyenv global 3.9.0を実行しています。

次に、$ pyenv global 3.8.6をしてみると、

$ rosrun mediapipe_ros app.py
[ERROR:0@0.638] global /io/opencv/modules/videoio/src/cap.cpp (164) open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.6.0) /io/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): /home/yuki/workspace/lidar_data/DATA_AOYAMA-suiyoubi/walk-senpai.mkv in function 'icvExtractPattern'


Downloading model to /home/yonelab/.pyenv/versions/3.8.6/lib/python3.8/site-packages/mediapipe/modules/objectron/object_detection_ssd_mobilenetv2_oidv4_fp16.tflite
Downloading model to /home/yonelab/.pyenv/versions/3.8.6/lib/python3.8/site-packages/mediapipe/modules/objectron/object_detection_3d_sneakers.tflite
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.

Downloadしているパスが、3.8.6の方になっています。

これらのことから、pyenvで指定しているpythonが呼ばれていると推測されます。

まとめ

自分の暫定的な考えです。間違っているかもしれません。その時は、追記します。
間違っていることがわかったら教えてていただけると幸いです。

0
0
1

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
0
0