mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Docs: Encourage to used Python 3
This commit is contained in:
parent
e2cba84555
commit
2a4173e9a6
5
Kconfig
5
Kconfig
@ -43,12 +43,11 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
||||
a crosstool-ng gcc setup that is in your PATH.
|
||||
|
||||
config SDK_PYTHON
|
||||
string "Python 2 interpreter"
|
||||
string "Python interpreter"
|
||||
depends on !IDF_CMAKE
|
||||
default "python"
|
||||
help
|
||||
The executable name/path that is used to run python. On some systems Python 2.x
|
||||
may need to be invoked as python2.
|
||||
The executable name/path that is used to run python.
|
||||
|
||||
(Note: This option is used with the legacy GNU Make build system only.)
|
||||
|
||||
|
@ -173,14 +173,15 @@ For more detailed information about integrating ESP-IDF with CMake into an IDE,
|
||||
|
||||
.. _setting-python-interpreter:
|
||||
|
||||
Setting the Python Interpreter
|
||||
------------------------------
|
||||
Setting up the Python Interpreter
|
||||
---------------------------------
|
||||
|
||||
Currently, ESP-IDF only works with Python 2.7. If you have a system where the default ``python`` interpreter is Python 3.x, this can lead to problems.
|
||||
ESP-IDF works well with all supported Python versions. It should work out-of-box even if you have a legacy system where the default ``python`` interpreter is still Python 2.7, however, it is advised to switch to Python 3 if possible.
|
||||
|
||||
If using ``idf.py``, running ``idf.py`` as ``python2 $IDF_PATH/tools/idf.py ...`` will work around this issue (``idf.py`` will tell other Python processes to use the same Python interpreter). You can set up a shell alias or another script to simplify the command.
|
||||
``idf.py`` and other Python scripts will run with the default Python interpreter, i.e. ``python``. You can switch to a
|
||||
different one like ``python3 $IDF_PATH/tools/idf.py ...``, or you can set up a shell alias or another script to simplify the command.
|
||||
|
||||
If using CMake directly, running ``cmake -D PYTHON=python2 ...`` will cause CMake to override the default Python interpreter.
|
||||
If using CMake directly, running ``cmake -D PYTHON=python3 ...`` will cause CMake to override the default Python interpreter.
|
||||
|
||||
If using an IDE with CMake, setting the ``PYTHON`` value as a CMake cache override in the IDE UI will override the default Python interpreter.
|
||||
|
||||
|
@ -179,11 +179,11 @@ The python packages required by ESP-IDF are located in ``IDF_PATH/requirements.t
|
||||
|
||||
.. note::
|
||||
|
||||
Please check the version of the Python interpreter that you will be using with ESP-IDF. For this, run
|
||||
the command ``python --version`` and depending on the result, you might want to use ``python2``, ``python2.7``
|
||||
Please check the version of the Python interpreter that you will be using with ESP-IDF. For this, run
|
||||
the command ``python --version`` and depending on the result, you might want to use ``python3``, ``python3.7``
|
||||
or similar instead of just ``python``, e.g.::
|
||||
|
||||
python2.7 -m pip install --user -r $IDF_PATH/requirements.txt
|
||||
python3 -m pip install --user -r $IDF_PATH/requirements.txt
|
||||
|
||||
|
||||
.. _get-started-start-project-legacy:
|
||||
@ -283,10 +283,6 @@ To navigate and use ``menuconfig``, press the following keys:
|
||||
* ``?`` while highlighting a configuration item to display help about that item
|
||||
* ``/`` to find configuration items
|
||||
|
||||
.. note::
|
||||
|
||||
If you are **Arch Linux** user, navigate to ``SDK tool configuration`` and change the name of ``Python 2 interpreter`` from ``python`` to ``python2``.
|
||||
|
||||
.. attention::
|
||||
|
||||
If you use ESP32-DevKitC board with the **ESP32-SOLO-1** module, enable single core mode (:ref:`CONFIG_FREERTOS_UNICORE`) in menuconfig before flashing examples.
|
||||
|
@ -20,7 +20,7 @@ To compile with ESP-IDF you need to get the following packages:
|
||||
|
||||
- Arch::
|
||||
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial python2-cryptography python2-future python2-pyparsing python2-pyelftools
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python-pyserial python-cryptography python-future python-pyparsing python-pyelftools
|
||||
|
||||
.. note::
|
||||
|
||||
|
@ -20,7 +20,7 @@ To compile with ESP-IDF you need to get the following packages:
|
||||
|
||||
- Arch::
|
||||
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial python2-cryptography python2-future python2-pyparsing python2-pyelftools
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python-pyserial python-cryptography python-future python-pyparsing python-pyelftools
|
||||
|
||||
.. note::
|
||||
|
||||
|
@ -289,8 +289,6 @@ Linux and macOS
|
||||
cd ~/esp/hello_world
|
||||
idf.py menuconfig
|
||||
|
||||
If your default version of Python is 3.x, you may need to run ``python2 $(which idf.py) menuconfig`` instead.
|
||||
|
||||
Windows
|
||||
~~~~~~~
|
||||
|
||||
|
@ -21,7 +21,7 @@ To compile with ESP-IDF you need to get the following packages:
|
||||
|
||||
- Arch::
|
||||
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial python2-click python2-cryptography python2-future python2-pyparsing python2-pyelftools cmake ninja ccache
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python-pyserial python-click python-cryptography python-future python-pyparsing python-pyelftools cmake ninja ccache
|
||||
|
||||
.. note::
|
||||
CMake version 3.5 or newer is required for use with ESP-IDF. Older Linux distributions may require updating, enabling of a "backports" repository, or installing of a "cmake3" package rather than "cmake".
|
||||
|
@ -11,15 +11,15 @@ To compile with ESP-IDF you need to get the following packages:
|
||||
|
||||
- CentOS 7::
|
||||
|
||||
sudo yum install git wget ncurses-devel flex bison gperf python pyserial python-pyelftools cmake ninja-build ccache
|
||||
sudo yum install git wget ncurses-devel flex bison gperf python cmake ninja-build ccache
|
||||
|
||||
- Ubuntu and Debian::
|
||||
|
||||
sudo apt-get install git wget libncurses-dev flex bison gperf python python-pip python-setuptools python-serial python-click python-cryptography python-future python-pyparsing python-pyelftools cmake ninja-build ccache libffi-dev libssl-dev
|
||||
sudo apt-get install git wget libncurses-dev flex bison gperf python python-pip python-setuptools cmake ninja-build ccache libffi-dev libssl-dev
|
||||
|
||||
- Arch::
|
||||
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pip python2-pyserial python2-click python2-cryptography python2-future python2-pyparsing python2-pyelftools cmake ninja ccache
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python-pip cmake ninja ccache
|
||||
|
||||
.. note::
|
||||
CMake version 3.5 or newer is required for use with ESP-IDF. Older Linux distributions may require updating, enabling of a "backports" repository, or installing of a "cmake3" package rather than "cmake".
|
||||
@ -32,7 +32,6 @@ Permission issues /dev/ttyUSB0
|
||||
|
||||
With some Linux distributions you may get the ``Failed to open port /dev/ttyUSB0`` error message when flashing the ESP32. :ref:`This can be solved by adding the current user to the dialout group<linux-dialout-group>`.
|
||||
|
||||
|
||||
Arch Linux Users
|
||||
----------------
|
||||
|
||||
@ -47,6 +46,19 @@ Before installing these packages you might need to add the author's public key t
|
||||
|
||||
Alternatively, use crosstool-NG to compile a gdb that links against ncurses 6.
|
||||
|
||||
Setting up Python 3 as default for Ubuntu and Debian
|
||||
----------------------------------------------------
|
||||
|
||||
Ubuntu and Debian are still providing Python 2.7 as the default interpreter. Python 3 can be installed as follows::
|
||||
|
||||
sudo apt-get install python3 python3-pip python3-setuptools
|
||||
|
||||
Making Python 3 the default interpreter is possible by running::
|
||||
|
||||
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
|
||||
|
||||
.. note::
|
||||
This is system-wide change which may affect all of the applications.
|
||||
|
||||
Next Steps
|
||||
==========
|
||||
|
@ -61,10 +61,10 @@ Download the ninja_ latest stable Windows release from the (`download page <ninj
|
||||
The Ninja for Windows download is a .zip file containing a single ``ninja.exe`` file which needs to be unzipped to a directory which is then `added to your Path <add-directory-windows-path>`_ (or you can choose a directory which is already on your Path).
|
||||
|
||||
|
||||
Python 2.x
|
||||
^^^^^^^^^^
|
||||
Python
|
||||
^^^^^^
|
||||
|
||||
Download the latest Python_ 2.7 for Windows installer, and run it.
|
||||
Download the latest Python_ for Windows installer, and run it.
|
||||
|
||||
The "Customise" step of the Python installer gives a list of options. The last option is "Add python.exe to Path". Change this option to select "Will be installed".
|
||||
|
||||
|
@ -179,9 +179,9 @@ ESP-IDF 所需 Python 软件包位于 ``IDF_PATH/requirements.txt`` 中。您可
|
||||
|
||||
.. note::
|
||||
|
||||
请注意查询您所使用的 Python 解释器的版本(运行命令 ``python --version``),并根据查询结果将上方命令中的 ``python`` 替换为 ``python2``, ``python2.7``,例如: ::
|
||||
请注意查询您所使用的 Python 解释器的版本(运行命令 ``python --version``),并根据查询结果将上方命令中的 ``python`` 替换为 ``python3``, ``python3.7``,例如::
|
||||
|
||||
python2.7 -m pip install --user -r $IDF_PATH/requirements.txt
|
||||
python3 -m pip install --user -r $IDF_PATH/requirements.txt
|
||||
|
||||
|
||||
.. _get-started-start-project-legacy:
|
||||
@ -279,10 +279,6 @@ Windows 操作系统
|
||||
* ``英文问号`` :调出有关高亮选项的帮助菜单
|
||||
* ``/ 键``:寻找配置项目
|
||||
|
||||
.. note::
|
||||
|
||||
如果您是 **Arch Linux** 用户,请前往 ``SDK tool configuration``,并将 ``Python 2 interpreter`` 的名称从 ``python`` 替换为 ``python2``。
|
||||
|
||||
.. attention::
|
||||
|
||||
如果您使用的是 ESP32-DevKitC(板载 ESP32-SOLO-1 模组),请在烧写示例程序前,前往 ``menuconfig`` 中使能单核模式(:ref:`CONFIG_FREERTOS_UNICORE`)。
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
- Arch::
|
||||
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial python2-cryptography python2-future python2-pyparsing python2-pyelftools
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python-pyserial python-cryptography python-future python-pyparsing python-pyelftools
|
||||
|
||||
.. note::
|
||||
|
||||
|
@ -20,7 +20,7 @@ Linux 平台工具链的标准设置 (传统 GNU Make)
|
||||
|
||||
- Arch::
|
||||
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial python2-cryptography python2-future python2-pyparsing python2-pyelftools
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python-pyserial python-cryptography python-future python-pyparsing python-pyelftools
|
||||
|
||||
.. note::
|
||||
|
||||
|
@ -276,8 +276,6 @@ Linux 和 MacOS 操作系统
|
||||
cd ~/esp/hello_world
|
||||
idf.py menuconfig
|
||||
|
||||
如果您的默认 Python 版本为 3.0 以上,可能需要运行 ``python2 idf.py`` 。
|
||||
|
||||
Windows 操作系统
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
- Arch::
|
||||
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial python2-click python2-cryptography python2-future python2-pyparsing python2-pyelftools cmake ninja ccache
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python-pyserial python-click python-cryptography python-future python-pyparsing python-pyelftools cmake ninja ccache
|
||||
|
||||
|
||||
.. note::
|
||||
|
@ -11,15 +11,15 @@ Linux 平台工具链的标准设置
|
||||
|
||||
- CentOS 7::
|
||||
|
||||
sudo yum install git wget ncurses-devel flex bison gperf python pyserial python-pyelftools cmake ninja-build ccache
|
||||
sudo yum install git wget ncurses-devel flex bison gperf python cmake ninja-build ccache
|
||||
|
||||
- Ubuntu 和 Debian::
|
||||
|
||||
sudo apt-get install git wget libncurses-dev flex bison gperf python python-click python-pip python-setuptools python-serial python-cryptography python-future python-pyparsing python-pyelftools cmake ninja-build ccache libffi-dev libssl-dev
|
||||
sudo apt-get install git wget libncurses-dev flex bison gperf python python-pip python-setuptools cmake ninja-build ccache libffi-dev libssl-dev
|
||||
|
||||
- Arch::
|
||||
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial python2-click python2-cryptography python2-future python2-pyparsing python2-pyelftools cmake ninja ccache
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python-pip cmake ninja ccache
|
||||
|
||||
.. note::
|
||||
使用 ESP-IDF 需要 CMake 3.5 或以上版本。较早版本的 Linux 可能需要升级才能向后移植仓库,或安装 "cmake3" 软件包,而不是安装 "cmake"。
|
||||
|
@ -33,10 +33,9 @@ Ninja 编译工具
|
||||
适用于 Windows 平台的 Ninja 下载文件是一个 .zip 文件,包含一个 ``ninja.exe`` 文件。将其解压到目录,并 `添加到你的路径 <add-directory-windows-path>`_ (或者选择你的路径中已有的目录)。
|
||||
|
||||
|
||||
Python 2.x
|
||||
^^^^^^^^^^
|
||||
Python
|
||||
^^^^^^
|
||||
|
||||
下载并运行适用于 Windows 安装器的最新版 `Python`_ 2.7。
|
||||
|
||||
Python 安装的“自定义”那一步提供了一份选项列表,最后一个选项是 "Add python.exe to Path"(添加 python.exe 到路径中),更改该选项,选择 "Will be installed"(将会安装)。
|
||||
|
||||
|
@ -18,7 +18,7 @@ python scripts/esp_local_ctrl.py
|
||||
Sample output:
|
||||
|
||||
```
|
||||
python2 scripts/esp_local_ctrl.py
|
||||
python scripts/esp_local_ctrl.py
|
||||
|
||||
==== Acquiring properties information ====
|
||||
|
||||
|
@ -8,7 +8,7 @@ This sort of persistency enables the server to have independent sessions/context
|
||||
* In order to test the HTTPD server persistent sockets demo :
|
||||
1. compile and burn the firmware `idf.py -p PORT flash`
|
||||
2. run `idf.py -p PORT monitor` and note down the IP assigned to your ESP module. The default port is 80
|
||||
3. run the test script "python2 scripts/adder.py \<IP\> \<port\> \<N\>"
|
||||
3. run the test script "python scripts/adder.py \<IP\> \<port\> \<N\>"
|
||||
* the provided test script sends (POST) numbers from 1 to N to the server which has a URI POST handler for adding these numbers into an accumulator that is valid throughout the lifetime of the connection socket, hence persistent
|
||||
* the script does a GET before closing and displays the final value of the accumulator
|
||||
|
||||
|
@ -10,7 +10,7 @@ The Example consists of HTTPD server demo with demostration of URI handling :
|
||||
1. compile and burn the firmware `idf.py -p PORT flash`
|
||||
2. run `idf.py -p PORT monitor` and note down the IP assigned to your ESP module. The default port is 80
|
||||
3. test the example :
|
||||
* run the test script : "python2 scripts/client.py \<IP\> \<port\> \<MSG\>"
|
||||
* run the test script : "python scripts/client.py \<IP\> \<port\> \<MSG\>"
|
||||
* the provided test script first does a GET \hello and displays the response
|
||||
* the script does a POST to \echo with the user input \<MSG\> and displays the response
|
||||
* or use curl (asssuming IP is 192.168.43.130):
|
||||
|
@ -22,7 +22,7 @@ Prerequisites
|
||||
- Linux / MacOS / Windows (standard distributions)
|
||||
|
||||
* The following packages are needed to use this utility:
|
||||
- Python version: 2.7 (minimum) is required. You can find it here: <https://www.python.org/downloads/>
|
||||
- Python: <https://www.python.org/downloads/>
|
||||
|
||||
.. note::
|
||||
|
||||
|
@ -34,7 +34,7 @@ set -e
|
||||
pacman --noconfirm -Syu # This step may require the terminal to be closed and restarted
|
||||
|
||||
pacman --noconfirm -S --needed gettext-devel gcc git make ncurses-devel flex bison gperf vim \
|
||||
mingw-w64-i686-python2-pip mingw-w64-i686-python2-cryptography unzip winpty
|
||||
mingw-w64-i686-python-pip mingw-w64-i686-python-cryptography unzip winpty
|
||||
|
||||
# if IDF_PATH is set, install requirements now as well
|
||||
if [ -n "$IDF_PATH" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user