mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-26 17:36:40 +08:00
build(macos): add Python venv support to setup script (#26702)
Signed-off-by: Ramon Roche <mrpollo@gmail.com> Co-authored-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
committed by
GitHub
parent
9b45769878
commit
b5e632ccf4
@@ -8,7 +8,7 @@ This environment can be used to build PX4 for:
|
||||
|
||||
It works on both Intel and Apple Silicon Macs.
|
||||
|
||||
:::tip
|
||||
::: tip
|
||||
This setup is supported by the PX4 dev team.
|
||||
To build for [other targets](../dev_setup/dev_env.md#supported-targets) you will need to use a [different OS](../dev_setup/dev_env.md#supported-targets) or an [unsupported development environment](../advanced/community_supported_dev_env.md).
|
||||
:::
|
||||
@@ -38,7 +38,7 @@ To build for [other targets](../dev_setup/dev_env.md#supported-targets) you will
|
||||
|
||||
4. **Ensure Python 3 is available.** Some PX4 build scripts require `python3` and `pip3` to be in your `PATH`. The Xcode Command Line Tools include Python 3 by default.
|
||||
|
||||
:::tip
|
||||
::: tip
|
||||
If you need to install or manage a different Python version, we recommend [pyenv](https://github.com/pyenv/pyenv), which lets you set global and per-directory Python versions.
|
||||
:::
|
||||
|
||||
@@ -58,6 +58,18 @@ To build for [other targets](../dev_setup/dev_env.md#supported-targets) you will
|
||||
./Tools/setup/macos.sh --sim-tools
|
||||
```
|
||||
|
||||
::: info
|
||||
The setup script creates a Python virtual environment at `.venv` in the repo root and installs all Python dependencies into it. This keeps PX4's Python requirements isolated from your system Python and avoids conflicts with Homebrew's externally-managed Python.
|
||||
|
||||
Activate it before building:
|
||||
|
||||
```sh
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
You'll need to re-run this command in each new terminal session. To activate it automatically when you `cd` into the repo, consider a tool like [direnv](https://direnv.net/) or add the activation to your `~/.zshrc`.
|
||||
:::
|
||||
|
||||
This installs:
|
||||
- **Toolchain packages** from the `osx-cross/arm` and `PX4/px4` Homebrew taps — ARM cross-compiler (`arm-gcc-bin@13`), `cmake`, `ninja`, `ccache`, `fastdds`, `genromfs`, `kconfig-frontends`, and other build tools
|
||||
- **Python packages** from `requirements.txt`
|
||||
|
||||
Reference in New Issue
Block a user