python-3.x 错误:无法为pyzmq构建wheel,这是安装基于pyproject.tom l的项目所必需的

suzh9iv8  于 12个月前  发布在  Python
关注(0)|答案(2)|浏览(365)

我无法在虚拟环境中使用VS Code上的Notebooks,因为安装ipykernel的问题。当我切换到全局环境时,ipykernel安装正常,我可以运行我的Notebooks。
如果我创建一个新文件夹,输入它,运行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安装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 Code版本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

aiqt4smr

aiqt4smr1#

Try install pyproject-toml==0.0.10最后一个版本不工作..

7xzttuei

7xzttuei2#

我解决了这个问题,通过在我的MacBook笔记本电脑(M1)上安装XCode

相关问题