본문으로 건너뛰기

0단계: 환경 설정

컴퓨터에 TuyaOpen에 필요한 툴체인을 설정하고 저장소를 다운로드한 다음, 모든 프로젝트를 구성하고 빌드하고 플래시할 때 사용하는 명령줄 도구 tos.py를 활성화합니다.

하드웨어 준비

시작하기 전에 다음을 준비하세요.

툴체인 설치

운영 체제를 선택하고 필요한 도구를 설치하세요.

정보

Ubuntu 24, 22, 20의 LTS 버전을 사용하는 것이 좋습니다.

필요한 도구를 설치합니다.

sudo apt-get install lcov cmake-curses-gui build-essential ninja-build wget git python3 python3-pip python3-venv libc6-i386 libsystemd-dev

TuyaOpen 다운로드 및 활성화

TuyaOpen 저장소를 복제합니다.

다음과 같이 git 설정을 조정하면 복제 성능을 높일 수 있습니다.

git config --global http.postBuffer 524288000
경고

프로젝트 경로에 중국어 또는 공백과 같은 특수 문자를 사용하지 마세요. Windows에서는 프로젝트를 C 드라이브에 두지 않는 것이 좋습니다.

# Use GitHub
git clone https://github.com/tuya/TuyaOpen.git

# Or use Gitee
git clone https://gitee.com/tuya-open/TuyaOpen.git

# Enter the project
cd TuyaOpen

tos.py를 활성화합니다.

경고

터미널을 다시 열 때마다 tos.py를 다시 활성화해야 합니다.

. ./export.sh

tos.py versiontos.py check를 실행하여 활성화를 확인합니다. 다음과 비슷한 출력이 표시됩니다.

❯ tos.py version
[INFO]: Running tos.py ...
[INFO]: v1.3.0

❯ tos.py check
[INFO]: Running tos.py ...
[INFO]: [git] (2.43.0 >= 2.0.0) is ok.
[INFO]: [cmake] (4.0.2 >= 3.28.0) is ok.
[INFO]: [make] (4.3 >= 3.0.0) is ok.
[INFO]: [ninja] (1.11.1 >= 1.6.0) is ok.
[INFO]: Downloading submodules...
[INFO]: [do subprocess]: cd /home/huatuo/work/open/TuyaOpen && git submodule update --init
[INFO]: Download submodules successfully.
check 명령이 실패하는 경우:
# Tool validation failed. Please install or upgrade the required tools.
# Submodules download failed. Manually execute the git command.
git submodule update --init

작업이 끝나면 tos.py를 비활성화합니다.

deactivate

tos.py 전체 설명은 tos.py --help를 실행하거나 CLI - tos.py 개발 도구를 참고하세요.

FAQ

tos.py 활성화에 실패합니다

  • python3-venv가 설치되지 않아 활성화가 실패할 수 있습니다. 설치한 후 다시 시도하세요.

    sudo apt-get install python3-venv
  • tos.py를 활성화하면 ./.venv 디렉터리가 자동으로 생성됩니다. 활성화에 실패하면 ./.venv 디렉터리를 삭제하고 다시 활성화하세요.