esp-idf 通过vscode安装时因python虚拟环境异常安装失败

安装esp-idf5.3,参考了一下链接
https://blog.51cto.com/zyxfighting/10579230
官方链接
https://www.bilibili.com/video/BV1YcpHewE6x/?vd_source=8d0989caec7829dc1b2933f6a3b45e6d

卡在python virtual enviroment 安装
报一下错误

Python 3.11.2

pip 24.2 from d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip (python 3.11)


Requirement already satisfied: pip in d:\espressif\tools\python_env\idf5.3_py3.11_env\lib\site-packages (24.2)

Collecting setuptools

  Using cached setuptools-71.0.0-py3-none-any.whl.metadata (6.5 kB)

Downloading setuptools-71.0.0-py3-none-any.whl (908 kB)

  
                                          0.0/908.4 kB ? eta -:--:--


ERROR: Exception:
Traceback (most recent call last):
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_vendor\urllib3\response.py", line 438, in _error_catcher
    yield
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_vendor\urllib3\response.py", line 561, in read
    data = self._fp_read(amt) if not fp_closed else b""
           ^^^^^^^^^^^^^^^^^^
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_vendor\urllib3\response.py", line 527, in _fp_read
    return self._fp.read(amt) if amt is not None else self._fp.read()
           ^^^^^^^^^^^^^^^^^^
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 98, in read
    data: bytes = self.__fp.read(amt)
                  ^^^^^^^^^^^^^^^^^^^
  File "http\client.py", line 465, in read
  File "socket.py", line 706, in readinto
  File "ssl.py", line 1278, in recv_into
  File "ssl.py", line 1134, in read
TimeoutError: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_internal\cli\base_command.py", line 105, in _run_wrapper
    status = _inner_run()
             ^^^^^^^^^^^^
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_internal\cli\base_command.py", line 96, in _inner_run
    return self.run(options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_internal\cli\req_command.py", line 67, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_internal\commands\install.py", line 379, in run
    requirement_set = resolver.resolve(
                      ^^^^^^^^^^^^^^^^^
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 179, in resolve
    self.factory.preparer.prepare_linked_requirements_more(reqs)
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_internal\operations\prepare.py", line 554, in prepare_linked_requirements_more
    self._complete_partial_requirements(
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_internal\operations\prepare.py", line 469, in _complete_partial_requirements
    for link, (filepath, _) in batch_download:
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_internal\network\download.py", line 184, in __call__
    for chunk in chunks:
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_internal\cli\progress_bars.py", line 55, in _rich_progress_bar
    for chunk in iterable:
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_internal\network\utils.py", line 65, in response_chunks
    for chunk in response.raw.stream(
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_vendor\urllib3\response.py", line 622, in stream
    data = self.read(amt=amt, decode_content=decode_content)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_vendor\urllib3\response.py", line 560, in read
    with self._error_catcher():
  File "contextlib.py", line 155, in __exit__
  File "d:\Espressif\tools\python_env\idf5.3_py3.11_env\Lib\site-packages\pip\_vendor\urllib3\response.py", line 443, in _error_catcher
    raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

Skipping the download of d:\Espressif\tools\espidf.constraints.v5.3.txt because it was downloaded recently.
Upgrading pip and setuptools...

Traceback (most recent call last):
  File "d:\Espressif\frameworks\esp-idf-v5.3.1\tools\idf_tools.py", line 3239, in <module>

    main(sys.argv[1:])

  File "d:\Espressif\frameworks\esp-idf-v5.3.1\tools\idf_tools.py", line 3231, in main

    action_func(args)
  File "d:\Espressif\frameworks\esp-idf-v5.3.1\tools\idf_tools.py", line 2654, in action_install_python_env

    subprocess.check_call(run_args, stdout=sys.stdout, stderr=sys.stderr, env=env_copy)

  File "subprocess.py", line 413, in check_call

subprocess.CalledProcessError: Command '['d:\\Espressif\\tools\\python_env\\idf5.3_py3.11_env\\Scripts\\python.exe', '-m', 'pip', 'install', '--upgrade', 'pip', 'setuptools', '--constraint', 'd:\\Espressif\\tools\\espidf.constraints.v5.3.txt']' returned non-zero exit status 2.

non zero exit code 1

解决方法:通过设置pip国内镜像源,解决下载超时的问题

  • 根据上面最后报错信息的最后两行,
subprocess.CalledProcessError: Command '['d:\\Espressif\\tools\\python_env\\idf5.3_py3.11_env\\Scripts\\python.exe', '-m', 'pip', 'install', '--upgrade', 'pip', 'setuptools', '--constraint', 'd:\\Espressif\\tools\\espidf.constraints.v5.3.txt']' returned non-zero exit status 2.

non zero exit code 1
  • 确定python路径d:\\Espressif\\tools\\python_env\\idf5.3_py3.11_env\\Scripts\\python.exe

  • python同级目录有pip3.exe

  • 重新开一个终端,设置pip为国内镜像源

D:\Espressif\tools\tools\idf-python\3.11.2\Scripts\pip3.11.exe config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
  • 然后再重新启动vscode,配置esp-idf,安装即可
在使用VSCode配置ESP-IDF环境时,有几个步骤需要遵循。 首先,需要下载并安装VSCode软件。然后,在VSCode中下载并安装Espressif IDF插件。这一步只需下载插件,不需要进行任何配置。接下来,需要下载ESP-IDF工具。可以在终端中运行以下命令来下载ESP-IDF工具: ``` mkdir -p ~/esp cd ~/esp git clone --recursive https://github.com/espressif/esp-idf.git ``` 在下载完成后,需要进行工具的配置。在终端中运行以下命令: ``` cd ~/esp/esp-idf ./install.sh ``` 然后,需要设置环境变量。同样在终端中运行以下命令: ``` cd ~/esp/esp-idf ./export.sh ``` 为了方便使用,可以在`~/.bashrc`文件中添加一个宏命令。打开`~/.bashrc`文件,可以使用以下命令: ``` vi ~/.bashrc ``` 在文件的最后一行添加以下命令: ``` alias get_idf='. $HOME/esp/esp-idf/export.sh' ``` 保存文件后,每次打开一个新的终端窗口,只需要输入`get_idf`命令,就可以给对应的终端窗口添加ESP-IDF的环境变量。 最后,可以创建自己的工程并开始开发。希望这些步骤能够帮助您成功配置ESP-IDF环境并在VSCode中进行开发。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [ESP-IDF/VSCode安装和使用(ESP32开发环境)](https://blog.csdn.net/luhanhua/article/details/131028184)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [ESP-IDF + Vscode ESP32 开发环境搭建以及开发入门](https://blog.csdn.net/qq_43332314/article/details/129015602)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值