Python pip报错解决

问题描述:Mac M2环境安装完Python后,pip click house驱动失败,报错信息为:

Collecting clickhouse-driver
Using cached clickhouse-driver-0.2.6.tar.gz (229 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: pytz in ./venv/lib/python3.9/site-packages (from clickhouse-driver) (2023.3)
Requirement already satisfied: tzlocal in ./venv/lib/python3.9/site-packages (from clickhouse-driver) (5.0.1)
Building wheels for collected packages: clickhouse-driver
Building wheel for clickhouse-driver (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
exit code: 1
╰─> [106 lines of output]

·

·

·

clickhouse_driver/bufferedreader.c:19: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 clickhouse-driver
Running setup.py clean for clickhouse-driver
Failed to build clickhouse-driver
ERROR: Could not build wheels for clickhouse-driver, which is required to install pyproject.toml-based projects

 

一开始思路放在which is required to install pyproject.toml-based projects上了,百度了很多方案都没办法解决

最后意识到需要仔细看一遍报错信息,于是针对python setup.py bdist_wheel did not run successfully.百度解决方案

 

最后使用以下命令解决:(治本)

pip install nes-py --no-cache-dir
pip install --upgrade pip setuptools wheel

 

解决方案原文:https://blog.csdn.net/GodGump/article/details/128608466

posted @ 2023-07-10 11:21  Princess1  阅读(461)  评论(0编辑  收藏  举报