Step 2 : Get Zephyr and install Python dependencies =================================================== .. tab-set:: .. tab-item:: Get Zephyr and install Python dependencies * In this program, you are going to learn .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * How to ? .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow Topics in this section, * :ref:`Install within virtual environment ` .. _zephyr_qemu_step2_0: .. tab-set:: .. tab-item:: Install within virtual environment * Make sure current directory is $HOME .. code-block:: c $ cd $HOME * Use ``apt`` to install Python ``venv`` package: .. code-block:: c $ sudo apt install python3-venv * Create a new virtual environment: .. code-block:: c $ python3 -m venv ~/zephyrproject/.venv * Activate the virtual environment: .. code-block:: c $ source ~/zephyrproject/.venv/bin/activate * See the command prompt changed, indicating that it is virtual environment .. code-block:: c (.venv) test:~$ * Install west: .. code-block:: c (.venv) test:~$ pip install west * Get the Zephyr source code: .. code-block:: c (.venv) test:~$ west init ~/zephyrproject (.venv) test:~$ cd ~/zephyrproject (.venv) test:~$ west update * Export a Zephyr CMake package. This allows CMake to automatically load boilerplate code required for building Zephyr applications. .. code-block:: c (.venv) test:~$ west zephyr-export * Zephyr’s scripts/requirements.txt file declares additional Python dependencies. Install them with pip. .. code-block:: c (.venv) test:~$ pip install -r ~/zephyrproject/zephyr/scripts/requirements.txt