错误:无法为 pyzmq 构建轮子,这是安装基于 pyproject.toml 的项目所必需的

问题描述 投票:0回答:1

由于安装 ipykernel 时出现问题,我无法在虚拟环境中的 VS Code 上使用 Jupyter 笔记本。当我切换到全局环境时,ipykernel 安装正常,我可以运行我的笔记本。

如果我创建一个新文件夹,进入它,运行

python3 -m venv venv
,然后运行
source venv/bin/activate
,然后运行
code .
,然后创建一个
.ipynb
文件并尝试在新单元格中执行任何代码,然后VS Code会提示我安装 ipykernel。所以我这样做了,VS Code 显示如下:

Running cells with 'Python 3.8.9 ('venv': venv)' requires ipykernel package.
Run the following command to install 'ipykernel' into the Python environment. 
Command: '/Users/my.name/Documents/test/venv/bin/python -m pip install ipykernel -U --force-reinstall'

所以我 pip install ipykernel,它向我抛出了这个错误:

ERROR: Could not build wheels for pyzmq, which is required to install pyproject.toml-based projects

我在 MacBook M1 Pro 上运行 macOS 12.5.1。 Visual Studio 代码版本 1.71.0。我的虚拟环境是Python 3.8.9。

可以采取哪些步骤来解决这个问题?

错误的其他一些看起来有用的部分:

Building wheels for collected packages: pyzmq
  Building wheel for pyzmq (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pyzmq (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [174 lines of output]

      Loads of lines saying "copying something -> somewhere" which I've edited out

      buildutils/initlibzmq.cpp:10:10: fatal error: 'Python.h' file not found
      #include "Python.h"
               ^~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang++' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyzmq
Failed to build pyzmq
ERROR: Could not build wheels for pyzmq, which is required to install pyproject.toml-based projects
python python-3.x jupyter-notebook pyzmq
1个回答
0
投票

尝试安装 pyproject-toml==0.0.10 最新版本无法使用...👍

© www.soinside.com 2019 - 2024. All rights reserved.