将版本从v3.3更新至v4.2版本后,idf.py无法使用

eric0924
Posts: 2
Joined: Fri Jan 17, 2020 3:21 pm

将版本从v3.3更新至v4.2版本后,idf.py无法使用

Postby eric0924 » Fri Mar 26, 2021 2:12 pm

看了官方的说明文档,v4.2采用Python3,所以将Python改为了python3.6,从github上下载了zip包,解压到~/esp目录下,分别完成了install.sh和export.sh结果都成功,分别如下:

Code: Select all

eric@eric-virtual-machine:~/esp/esp-idf$ sudo ./install.sh
[sudo] password for eric: 
Detecting the Python interpreter
Checking "python" ...
Python 3.6.9
"python" has been detected
Installing ESP-IDF tools
Installing tools: xtensa-esp32-elf, xtensa-esp32s2-elf, esp32ulp-elf, esp32s2ulp-elf, openocd-esp32
Skipping xtensa-esp32-elf@esp-2020r3-8.4.0 (already installed)
Skipping xtensa-esp32s2-elf@esp-2020r3-8.4.0 (already installed)
Skipping esp32ulp-elf@2.28.51-esp-20191205 (already installed)
Skipping esp32s2ulp-elf@2.28.51-esp-20191205 (already installed)
Skipping openocd-esp32@v0.10.0-esp32-20200709 (already installed)
Installing Python environment and packages
fatal: not a git repository (or any of the parent directories): .git
WARNING: Git describe was unsuccessul: Command '['git', 'describe']' returned non-zero exit status 128.
Installing Python packages from /home/eric/esp/esp-idf/requirements.txt
WARNING: The directory '/home/eric/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Ignoring python-socketio: markers 'python_version <= "2.7"' don't match your environment
Ignoring None: markers 'sys_platform == "win32"' don't match your environment
Requirement already satisfied: setuptools>=21 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from -r /home/eric/esp/esp-idf/requirements.txt (line 4)) (54.1.2)
Requirement already satisfied: click>=5.0 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from -r /home/eric/esp/esp-idf/requirements.txt (line 8)) (7.1.2)
Requirement already satisfied: pyserial>=3.0 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from -r /home/eric/esp/esp-idf/requirements.txt (line 9)) (3.5)
Requirement already satisfied: future>=0.15.2 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from -r /home/eric/esp/esp-idf/requirements.txt (line 10)) (0.18.2)
Requirement already satisfied: cryptography>=2.1.4 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from -r /home/eric/esp/esp-idf/requirements.txt (line 11)) (3.4.7)
Requirement already satisfied: pyparsing<2.4.0,>=2.0.3 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from -r /home/eric/esp/esp-idf/requirements.txt (line 12)) (2.3.1)
Requirement already satisfied: pyelftools>=0.22 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from -r /home/eric/esp/esp-idf/requirements.txt (line 13)) (0.27)
Requirement already satisfied: gdbgui==0.13.2.0 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from -r /home/eric/esp/esp-idf/requirements.txt (line 15)) (0.13.2.0)
Requirement already satisfied: pygdbmi<=0.9.0.2 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from -r /home/eric/esp/esp-idf/requirements.txt (line 18)) (0.9.0.2)
Requirement already satisfied: reedsolo<=1.5.4,>=1.5.3 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from -r /home/eric/esp/esp-idf/requirements.txt (line 23)) (1.5.4)
Requirement already satisfied: bitstring>=3.1.6 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from -r /home/eric/esp/esp-idf/requirements.txt (line 24)) (3.1.7)
Requirement already satisfied: ecdsa>=0.16.0 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from -r /home/eric/esp/esp-idf/requirements.txt (line 25)) (0.16.1)
Requirement already satisfied: gevent<2.0,>=1.2.2 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from gdbgui==0.13.2.0->-r /home/eric/esp/esp-idf/requirements.txt (line 15)) (1.5.0)
Requirement already satisfied: Flask-SocketIO<3.0,>=2.9 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from gdbgui==0.13.2.0->-r /home/eric/esp/esp-idf/requirements.txt (line 15)) (2.9.6)
Requirement already satisfied: Flask<1.0,>=0.12.2 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from gdbgui==0.13.2.0->-r /home/eric/esp/esp-idf/requirements.txt (line 15)) (0.12.5)
Requirement already satisfied: Flask-Compress<2.0,>=1.4.0 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from gdbgui==0.13.2.0->-r /home/eric/esp/esp-idf/requirements.txt (line 15)) (1.9.0)
Requirement already satisfied: Pygments<3.0,>=2.2.0 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from gdbgui==0.13.2.0->-r /home/eric/esp/esp-idf/requirements.txt (line 15)) (2.8.1)
Requirement already satisfied: cffi>=1.12 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from cryptography>=2.1.4->-r /home/eric/esp/esp-idf/requirements.txt (line 11)) (1.14.5)
Requirement already satisfied: six>=1.9.0 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from ecdsa>=0.16.0->-r /home/eric/esp/esp-idf/requirements.txt (line 25)) (1.15.0)
Requirement already satisfied: pycparser in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from cffi>=1.12->cryptography>=2.1.4->-r /home/eric/esp/esp-idf/requirements.txt (line 11)) (2.20)
Requirement already satisfied: itsdangerous>=0.21 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from Flask<1.0,>=0.12.2->gdbgui==0.13.2.0->-r /home/eric/esp/esp-idf/requirements.txt (line 15)) (1.1.0)
Requirement already satisfied: Jinja2>=2.4 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from Flask<1.0,>=0.12.2->gdbgui==0.13.2.0->-r /home/eric/esp/esp-idf/requirements.txt (line 15)) (2.11.3)
Requirement already satisfied: Werkzeug<1.0,>=0.7 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from Flask<1.0,>=0.12.2->gdbgui==0.13.2.0->-r /home/eric/esp/esp-idf/requirements.txt (line 15)) (0.16.1)
Requirement already satisfied: brotli in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from Flask-Compress<2.0,>=1.4.0->gdbgui==0.13.2.0->-r /home/eric/esp/esp-idf/requirements.txt (line 15)) (1.0.9)
Requirement already satisfied: python-socketio>=1.6.1 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from Flask-SocketIO<3.0,>=2.9->gdbgui==0.13.2.0->-r /home/eric/esp/esp-idf/requirements.txt (line 15)) (5.1.0)
Requirement already satisfied: greenlet>=0.4.14 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from gevent<2.0,>=1.2.2->gdbgui==0.13.2.0->-r /home/eric/esp/esp-idf/requirements.txt (line 15)) (1.0.0)
Requirement already satisfied: MarkupSafe>=0.23 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from Jinja2>=2.4->Flask<1.0,>=0.12.2->gdbgui==0.13.2.0->-r /home/eric/esp/esp-idf/requirements.txt (line 15)) (1.1.1)
Requirement already satisfied: bidict>=0.21.0 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from python-socketio>=1.6.1->Flask-SocketIO<3.0,>=2.9->gdbgui==0.13.2.0->-r /home/eric/esp/esp-idf/requirements.txt (line 15)) (0.21.2)
Requirement already satisfied: python-engineio>=4 in /home/eric/.espressif/python_env/idf4.2_py3.6_env/lib/python3.6/site-packages (from python-socketio>=1.6.1->Flask-SocketIO<3.0,>=2.9->gdbgui==0.13.2.0->-r /home/eric/esp/esp-idf/requirements.txt (line 15)) (4.0.1)
All done! You can now run:

  . ./export.sh

Code: Select all

eric@eric-virtual-machine:~/esp/esp-idf$ . ./export.sh
Detecting the Python interpreter
Checking "python" ...
Python 3.6.9
"python" has been detected
Adding ESP-IDF tools to PATH...
fatal: not a git repository (or any of the parent directories): .git
WARNING: Git describe was unsuccessul: Command '['git', 'describe']' returned non-zero exit status 128.
Using Python interpreter in /home/eric/.espressif/python_env/idf4.2_py3.6_env/bin/python
Checking if Python packages are up to date...
Python requirements from /home/eric/esp/esp-idf/requirements.txt are satisfied.
Added the following directories to PATH:
  /home/eric/esp/esp-idf/components/esptool_py/esptool
  /home/eric/esp/esp-idf/components/espcoredump
  /home/eric/esp/esp-idf/components/partition_table
  /home/eric/esp/esp-idf/components/app_update
  /home/eric/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin
  /home/eric/.espressif/tools/xtensa-esp32s2-elf/esp-2020r3-8.4.0/xtensa-esp32s2-elf/bin
  /home/eric/.espressif/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin
  /home/eric/.espressif/tools/esp32s2ulp-elf/2.28.51-esp-20191205/esp32s2ulp-elf-binutils/bin
  /home/eric/.espressif/tools/openocd-esp32/v0.10.0-esp32-20200709/openocd-esp32/bin
  /home/eric/.espressif/python_env/idf4.2_py3.6_env/bin
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:

  idf.py build

然而,在实例项目的目录下,使用idf.py报错,报错信息如下:

Code: Select all

eric@eric-virtual-machine:~/esp/esp-idf$ idf.py
Traceback (most recent call last):
  File "/home/eric/esp/esp-idf/tools/idf.py", line 45, in <module>
    from idf_py_actions.tools import (executable_exists, idf_version, merge_action_lists, realpath)  # noqa: E402
  File "/home/eric/esp/esp-idf/tools/idf_py_actions/tools.py", line 1, in <module>
    import click
ModuleNotFoundError: No module named 'click'
请问如何解决呢?不胜感激!

ESP_Gargamel
Posts: 786
Joined: Wed Nov 14, 2018 8:45 am

Re: 将版本从v3.3更新至v4.2版本后,idf.py无法使用

Postby ESP_Gargamel » Mon Mar 29, 2021 1:58 am

1、install 时,应该不用 sudo,不过这个在这个 case 里好像没影响
2、你在 export 之后,pip list 看下是否有 click?

Who is online

Users browsing this forum: Baidu [Spider] and 107 guests