diff --git a/Kconfig b/Kconfig index 92b9dd72c..3fb7e5531 100644 --- a/Kconfig +++ b/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.) diff --git a/docs/en/api-guides/build-system.rst b/docs/en/api-guides/build-system.rst index 602b3c4e6..a0cb96d39 100644 --- a/docs/en/api-guides/build-system.rst +++ b/docs/en/api-guides/build-system.rst @@ -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. diff --git a/docs/en/get-started-legacy/index.rst b/docs/en/get-started-legacy/index.rst index c7be315a8..ae5401745 100644 --- a/docs/en/get-started-legacy/index.rst +++ b/docs/en/get-started-legacy/index.rst @@ -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. diff --git a/docs/en/get-started-legacy/linux-setup-scratch.rst b/docs/en/get-started-legacy/linux-setup-scratch.rst index 7bed3f25d..652868da0 100644 --- a/docs/en/get-started-legacy/linux-setup-scratch.rst +++ b/docs/en/get-started-legacy/linux-setup-scratch.rst @@ -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:: diff --git a/docs/en/get-started-legacy/linux-setup.rst b/docs/en/get-started-legacy/linux-setup.rst index 2a6e70815..bc7e3e718 100644 --- a/docs/en/get-started-legacy/linux-setup.rst +++ b/docs/en/get-started-legacy/linux-setup.rst @@ -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:: diff --git a/docs/en/get-started/index.rst b/docs/en/get-started/index.rst index 713362bb7..83f9e91e6 100644 --- a/docs/en/get-started/index.rst +++ b/docs/en/get-started/index.rst @@ -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 ~~~~~~~ diff --git a/docs/en/get-started/linux-setup-scratch.rst b/docs/en/get-started/linux-setup-scratch.rst index e09be07cd..76991379b 100644 --- a/docs/en/get-started/linux-setup-scratch.rst +++ b/docs/en/get-started/linux-setup-scratch.rst @@ -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". diff --git a/docs/en/get-started/linux-setup.rst b/docs/en/get-started/linux-setup.rst index d89781f23..b1e44446d 100644 --- a/docs/en/get-started/linux-setup.rst +++ b/docs/en/get-started/linux-setup.rst @@ -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`. - 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 ========== diff --git a/docs/en/get-started/windows-setup-scratch.rst b/docs/en/get-started/windows-setup-scratch.rst index d0bef754d..3f306a0bd 100644 --- a/docs/en/get-started/windows-setup-scratch.rst +++ b/docs/en/get-started/windows-setup-scratch.rst @@ -61,10 +61,10 @@ Download the ninja_ latest stable Windows release from the (`download page `_ (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". diff --git a/docs/zh_CN/get-started-legacy/index.rst b/docs/zh_CN/get-started-legacy/index.rst index 1c39ed934..194190751 100644 --- a/docs/zh_CN/get-started-legacy/index.rst +++ b/docs/zh_CN/get-started-legacy/index.rst @@ -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`)。 diff --git a/docs/zh_CN/get-started-legacy/linux-setup-scratch.rst b/docs/zh_CN/get-started-legacy/linux-setup-scratch.rst index 202aff0dd..7b6173114 100644 --- a/docs/zh_CN/get-started-legacy/linux-setup-scratch.rst +++ b/docs/zh_CN/get-started-legacy/linux-setup-scratch.rst @@ -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:: diff --git a/docs/zh_CN/get-started-legacy/linux-setup.rst b/docs/zh_CN/get-started-legacy/linux-setup.rst index ec6cc52fb..c9b6d5202 100644 --- a/docs/zh_CN/get-started-legacy/linux-setup.rst +++ b/docs/zh_CN/get-started-legacy/linux-setup.rst @@ -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:: diff --git a/docs/zh_CN/get-started/index.rst b/docs/zh_CN/get-started/index.rst index 06428eb99..e0b786d1f 100644 --- a/docs/zh_CN/get-started/index.rst +++ b/docs/zh_CN/get-started/index.rst @@ -276,8 +276,6 @@ Linux 和 MacOS 操作系统 cd ~/esp/hello_world idf.py menuconfig -如果您的默认 Python 版本为 3.0 以上,可能需要运行 ``python2 idf.py`` 。 - Windows 操作系统 ~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/zh_CN/get-started/linux-setup-scratch.rst b/docs/zh_CN/get-started/linux-setup-scratch.rst index 9a0fc54b6..cf4cce448 100644 --- a/docs/zh_CN/get-started/linux-setup-scratch.rst +++ b/docs/zh_CN/get-started/linux-setup-scratch.rst @@ -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:: diff --git a/docs/zh_CN/get-started/linux-setup.rst b/docs/zh_CN/get-started/linux-setup.rst index 44afa01e8..c2cd1ef9a 100644 --- a/docs/zh_CN/get-started/linux-setup.rst +++ b/docs/zh_CN/get-started/linux-setup.rst @@ -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"。 diff --git a/docs/zh_CN/get-started/windows-setup-scratch.rst b/docs/zh_CN/get-started/windows-setup-scratch.rst index 56f5d7d30..48b291a14 100644 --- a/docs/zh_CN/get-started/windows-setup-scratch.rst +++ b/docs/zh_CN/get-started/windows-setup-scratch.rst @@ -33,10 +33,9 @@ Ninja 编译工具 适用于 Windows 平台的 Ninja 下载文件是一个 .zip 文件,包含一个 ``ninja.exe`` 文件。将其解压到目录,并 `添加到你的路径 `_ (或者选择你的路径中已有的目录)。 -Python 2.x -^^^^^^^^^^ +Python +^^^^^^ -下载并运行适用于 Windows 安装器的最新版 `Python`_ 2.7。 Python 安装的“自定义”那一步提供了一份选项列表,最后一个选项是 "Add python.exe to Path"(添加 python.exe 到路径中),更改该选项,选择 "Will be installed"(将会安装)。 diff --git a/examples/protocols/esp_local_ctrl/README.md b/examples/protocols/esp_local_ctrl/README.md index b16b48547..37db6bce2 100644 --- a/examples/protocols/esp_local_ctrl/README.md +++ b/examples/protocols/esp_local_ctrl/README.md @@ -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 ==== diff --git a/examples/protocols/http_server/persistent_sockets/README.md b/examples/protocols/http_server/persistent_sockets/README.md index 24c82a18a..00d456ee3 100644 --- a/examples/protocols/http_server/persistent_sockets/README.md +++ b/examples/protocols/http_server/persistent_sockets/README.md @@ -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 \ \ \" + 3. run the test script "python scripts/adder.py \ \ \" * 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 diff --git a/examples/protocols/http_server/simple/README.md b/examples/protocols/http_server/simple/README.md index d9e9207fb..30eed559a 100644 --- a/examples/protocols/http_server/simple/README.md +++ b/examples/protocols/http_server/simple/README.md @@ -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 \ \ \" + * run the test script : "python scripts/client.py \ \ \" * the provided test script first does a GET \hello and displays the response * the script does a POST to \echo with the user input \ and displays the response * or use curl (asssuming IP is 192.168.43.130): diff --git a/tools/mass_mfg/docs/README.rst b/tools/mass_mfg/docs/README.rst index e38b1f1ec..2bdbb27f5 100644 --- a/tools/mass_mfg/docs/README.rst +++ b/tools/mass_mfg/docs/README.rst @@ -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: + - Python: .. note:: diff --git a/tools/windows/windows_install_prerequisites.sh b/tools/windows/windows_install_prerequisites.sh index 3b74583f9..baf183898 100644 --- a/tools/windows/windows_install_prerequisites.sh +++ b/tools/windows/windows_install_prerequisites.sh @@ -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