From b997ee185fe2ef22c5cfea42eb4b6c79e86f9864 Mon Sep 17 00:00:00 2001 From: MikiTwenty <97092783+MikiTwenty@users.noreply.github.com> Date: Fri, 24 May 2024 14:47:09 +0200 Subject: [PATCH] Fixed python compatibility. Added requirements.txt --- README zh.md | 6 +++--- README.md | 2 +- requirements.txt | 4 ++++ setup.py | 32 ++++++++++++++++++-------------- 4 files changed, 26 insertions(+), 18 deletions(-) create mode 100644 requirements.txt diff --git a/README zh.md b/README zh.md index a7e6a8c..66989c8 100644 --- a/README zh.md +++ b/README zh.md @@ -3,7 +3,7 @@ unitree_sdk2 python 接口 # 安装 ## 依赖 -- python>=3.8 +- python>=3.8,<3.11 - cyclonedds==0.10.2 - numpy - opencv-python @@ -25,7 +25,7 @@ Could not locate cyclonedds. Try to set CYCLONEDDS_HOME or CMAKE_PREFIX_PATH 该错误提示找不到 cyclonedds 路径。首先编译安装cyclonedds: ```bash cd ~ -git clone https://github.com/eclipse-cyclonedds/cyclonedds -b releases/0.10.x +git clone https://github.com/eclipse-cyclonedds/cyclonedds -b releases/0.10.x cd cyclonedds && mkdir build install && cd build cmake .. -DCMAKE_INSTALL_PREFIX=../install cmake --build . --target install @@ -102,7 +102,7 @@ python3 ./example/wireless_controller/wireless_controller.py enp2s0 终端将输出每一个按键的状态。对于遥控器按键的定义和数据结构可见: https://support.unitree.com/home/zh/developer/Get_remote_control_status ## 前置摄像头 -使用opencv获取前置摄像头(确保在有图形界面的系统下运行, 按 ESC 退出程序): +使用opencv获取前置摄像头(确保在有图形界面的系统下运行, 按 ESC 退出程序): ```bash python3 ./example/front_camera/camera_opencv.py enp2s0 ``` diff --git a/README.md b/README.md index 2dda4da..9d4f5d8 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Python interface for unitree sdk2 # Installation ## Dependencies -- Python >= 3.8 +- Python >= 3.8, < 3.11 - cyclonedds == 0.10.2 - numpy - opencv-python diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e4db7de --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +numpy +typeguard +opencv-python +cyclonedds==0.10.2 \ No newline at end of file diff --git a/setup.py b/setup.py index b69821b..13e456b 100644 --- a/setup.py +++ b/setup.py @@ -1,16 +1,20 @@ from setuptools import setup, find_packages -setup(name='unitree_sdk2py', - version='1.0.0', - author='Unitree', - author_email='unitree@unitree.com', - license="BSD-3-Clause", - packages=find_packages(), - description='Unitree robot sdk version 2 for python', - python_requires='>=3.8', - install_requires=[ - "cyclonedds==0.10.2", - "numpy", - "opencv-python", - ], - ) + +def load_requirements(filename:str='requirements.txt') -> None: + with open(filename, 'r') as file: + return [line.strip() for line in file if line and not line.startswith("#")] + +requirements = load_requirements() + +setup( + name='unitree_sdk2py', + version='1.0.0', + author='Unitree', + author_email='unitree@unitree.com', + license="BSD-3-Clause", + packages=find_packages(), + description='Unitree robot sdk version 2 for python', + python_requires='>=3.8,<3.11', + install_requires=requirements +) \ No newline at end of file