升级工具链里面的pip

C:\Users\yjw\.espressif\python_env\idf4.2_py3.8_env\Scripts\python.exe -m pip install --upgrade pip

错误提示如下:

The following Python requirements are not satisfied:
click>=5.0
pyserial>=3.0
future>=0.15.2
cryptography>=2.1.4
pyparsing>=2.0.3,<2.4.0
pyelftools>=0.22
esp-windows-curses; sys_platform == 'win32'
To install the missing packages, please run "E:\HardwareProject\ESP32\esp-idf-v4.1.1\esp-idf\install.bat"
CMake Error at E:/HardwareProject/ESP32/esp-idf-v4.1.1/esp-idf/tools/cmake/build.cmake:271 (message):
  Some Python dependencies must be installed.  Check above message for
  details.
Call Stack (most recent call first):
  E:/HardwareProject/ESP32/esp-idf-v4.1.1/esp-idf/tools/cmake/build.cmake:397 (__build_check_python)
  E:/HardwareProject/ESP32/esp-idf-v4.1.1/esp-idf/tools/cmake/project.cmake:396 (idf_build_process)
  CMakeLists.txt:6 (project)


-- Configuring incomplete, errors occurred!
See also "E:/workspace/eclipse/esp_hello_word/build/CMakeFiles/CMakeOutput.log".
cmake --build . -- -v
ninja: error: loading 'build.ninja': 系统找不到指定的文件。

提示说Python环境配置不符合要求,让运行install.bat脚本。
E:\HardwareProject\ESP32\esp-idf-v4.1.1\esp-idf>install.bat
出现如下错误:

Installing Python packages from E:\HardwareProject\ESP32\esp-idf-v4.1.1\esp-idf\requirements.txt
Requirement already satisfied: setuptools>=21 in c:\users\administrator\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages (from -r E:\HardwareProject\ESP32\esp-idf-v4.1.1\esp-idf\requirements.txt (line 4)) (51.1.0.post20201221)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1107: The handshake operation timed out'))': /simple/click/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1107: The handshake operation timed out'))': /simple/click/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1107: The handshake operation timed out'))': /simple/click/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1107: The handshake operation timed out'))': /simple/click/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1107: The handshake operation timed out'))': /simple/click/
ERROR: Could not find a version that satisfies the requirement click>=5.0
ERROR: No matching distribution found for click>=5.0

这里明显是python自带的pip连接问题。我们更改pip源,并且升级pip。

#临时使用清华大学开源软件镜像站
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
#升级 pip
pip install -U pip

升级完成后重新运行install.bat脚本

E:\HardwareProject\ESP32\esp-idf-v4.1.1\esp-idf>install.bat
Installing ESP-IDF tools
Installing tools: xtensa-esp32-elf, xtensa-esp32s2-elf, esp32ulp-elf, esp32s2ulp-elf, cmake, openocd-esp32, ninja, idf-exe, ccache
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 cmake@3.13.4 (already installed)
Skipping openocd-esp32@v0.10.0-esp32-20200709 (already installed)
Skipping ninja@1.9.0 (already installed)
Skipping idf-exe@1.0.1 (already installed)
Skipping ccache@3.7 (already installed)
Setting up Python environment
Installing Python packages from E:\HardwareProject\ESP32\esp-idf-v4.1.1\esp-idf\requirements.txt
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Requirement already satisfied: setuptools>=21 in c:\users\administrator\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages (from -r E:\HardwareProject\ESP32\esp-idf-v4.1.1\esp-idf\requirements.txt (line 4)) (51.1.0.post20201221)
Processing e:\hardwareproject\esp32\esp-idf-v4.1.1\esp-idf\tools\kconfig_new\esp-windows-curses
Collecting click>=5.0
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl (82 kB)
     |████████████████████████████████| 82 kB 408 kB/s
Collecting cryptography>=2.1.4
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/64/03/b2a66da95d0a0acac2b5348526f9b92302136563444b33c7049cbdfecf69/cryptography-3.4.6-cp36-abi3-win_amd64.whl (1.6 MB)
     |████████████████████████████████| 1.6 MB 6.8 MB/s
Collecting future>=0.15.2
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz (829 kB)
     |████████████████████████████████| 829 kB 3.2 MB/s
Collecting pyelftools>=0.22
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/6f/50/3d7729d64bb23393aa4c166af250a6e6f9def40c90bf0e9af3c5ad25b6f7/pyelftools-0.27-py2.py3-none-any.whl (151 kB)
     |████████████████████████████████| 151 kB 6.4 MB/s
Collecting pyparsing<2.4.0,>=2.0.3
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/de/0a/001be530836743d8be6c2d85069f46fecf84ac6c18c7f5fb8125ee11d854/pyparsing-2.3.1-py2.py3-none-any.whl (61 kB)
     |████████████████████████████████| 61 kB 4.5 MB/s
Collecting pyserial>=3.0
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/07/bc/587a445451b253b285629263eb51c2d8e9bcea4fc97826266d186f96f558/pyserial-3.5-py2.py3-none-any.whl (90 kB)
     |████████████████████████████████| 90 kB 5.8 MB/s
Collecting cffi>=1.12
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/b4/8c/f7ba28010df236a61644b6cedd83d1e2e0bf84b4e5e534db536b490cfde0/cffi-1.14.5-cp38-cp38-win_amd64.whl (179 kB)
     |████████████████████████████████| 179 kB 6.4 MB/s
Collecting pycparser
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/ae/e7/d9c3a176ca4b02024debf82342dab36efadfc5776f9c8db077e8f6e71821/pycparser-2.20-py2.py3-none-any.whl (112 kB)
     |████████████████████████████████| 112 kB 6.4 MB/s
Collecting windows-curses
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/09/e7/8770bfbe4e8264c86af7ab1d8320fcfc18fcd4955814ae698fafc985d26a/windows_curses-2.2.0-cp38-cp38-win_amd64.whl (88 kB)
     |████████████████████████████████| 88 kB 2.3 MB/s
Building wheels for collected packages: esp-windows-curses, future
  Building wheel for esp-windows-curses (setup.py) ... done
  Created wheel for esp-windows-curses: filename=esp_windows_curses-0.1-py3-none-any.whl size=1170 sha256=ce37e6ffda2a60da469d4aebdd7563e2c6be912e1ab556dcd998aab13be1fcd7
  Stored in directory: c:\users\administrator\appdata\local\pip\cache\wheels\07\76\f3\d7cb35d8929b713678086bbf656a08b541625cd7ae03f25cd8
  Building wheel for future (setup.py) ... done
  Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491059 sha256=65de0750ecf42780d677fa69fa67e0cad78a469ed7b697623c1dc471c061cc15
  Stored in directory: c:\users\administrator\appdata\local\pip\cache\wheels\1b\3e\31\72653079400d50aff1c3492982a6965994629072cad3b97720
Successfully built esp-windows-curses future
Installing collected packages: pycparser, windows-curses, cffi, pyserial, pyparsing, pyelftools, future, esp-windows-curses, cryptography, click
Successfully installed cffi-1.14.5 click-7.1.2 cryptography-3.4.6 esp-windows-curses-0.1 future-0.18.2 pycparser-2.20 pyelftools-0.27 pyparsing-2.3.1 pyserial-3.5 windows-curses-2.2.0
WARNING: You are using pip version 20.3.3; however, version 21.0.1 is available.
You should consider upgrading via the 'C:\Users\Administrator\.espressif\python_env\idf4.1_py3.8_env\Scripts\python.exe -m pip install --upgrade pip' command.
All done! You can now run:
   export.bat

这里就可以看到安装成功了,但是还有一个警告,我们根据提示运行相应代码:
C:\Users\Administrator\.espressif\python_env\idf4.1_py3.8_env\Scripts\python.exe -m pip install --upgrade pip

E:\HardwareProject\ESP32\esp-idf-v4.1.1\esp-idf>C:\Users\Administrator\.espressif\python_env\idf4.1_py3.8_env\Scripts\python.exe -m pip install --upgrade pip
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Requirement already satisfied: pip in c:\users\administrator\.espressif\python_env\idf4.1_py3.8_env\lib\site-packages (20.3.3)
Collecting pip
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/fe/ef/60d7ba03b5c442309ef42e7d69959f73aacccd0d86008362a681c4698e83/pip-21.0.1-py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 1.3 MB/s
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.3.3
    Uninstalling pip-20.3.3:
      Successfully uninstalled pip-20.3.3
Successfully installed pip-21.0.1

到这里问题就解决了!

最后修改:2021 年 04 月 12 日
男宾一位~ 欢迎下次再来!