在安装pyrealsense2的时候,通过下面命令难以安装成功
pip install pyrealsense2
接下来介绍一种通过.whl文件安装的方法
一、电脑配置
1、Windows 10 64位
2、python3.7
二、下载链接
https://pypi.org/project/pyrealsense2/#files
点击cp37,win_amd64的whl文件 ,下载
三、安装
打开cmd,进入pyrealsense2-2.48.0.3381-cp37-cp37m-win_amd64.whl所在的文件夹,然后输入
pip install pyrealsense2-2.48.0.3381-cp37-cp37m-win_amd64.whl
即可安装成功
四、验证实例
先连接摄像头,然后新建一个python代码,如下
import pyrealsense2 as rs
pipe = rs.pipeline()
profile = pipe.start()
try:
for i in range(0, 100):
frames = pipe.wait_for_frames()
for f in frames:
print(f.profile)
finally:
pipe.stop()
输出结果:
<pyrealsense2.stream_profile: Gyro(0) @ 200fps MOTION_XYZ32F>
<pyrealsense2.video_stream_profile: Depth(0) 640x480 @ 15fps Z16>
<pyrealsense2.video_stream_profile: Color(0) 640x480 @ 15fps RGB8>
<pyrealsense2.stream_profile: Accel(0) @ 63fps MOTION_XYZ32F>
<pyrealsense2.stream_profile: Gyro(0) @ 200fps MOTION_XYZ32F>