文章内容

2024/1/25 5:58:14,作 者: 黄兵

ERROR: Failed building wheel for psycopg2

今天在安装 Python 项目依赖包的时候出现了如下错误:

 ERROR: Failed building wheel for psycopg2

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

错误截图如下:

具体出现错误的原因未知。

解决方案

执行如下命令:

pip uninstall psycopg2
pip list --outdated
pip install --upgrade wheel
pip install --upgrade setuptools
pip install psycopg2

通过上面的命令还是没有解决问题,同时还注意到有这样一个错误提示:

error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

之后参考了这篇文章:error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

执行如下命令:

sudo apt-get install python3 python-dev python3-dev \
     build-essential libssl-dev libffi-dev \
     libxml2-dev libxslt1-dev zlib1g-dev \
     python3-pip

最后问题解决。


参考资料

1、"Failed building wheel for psycopg2" - MacOSX using virtualenv and pip

2、error: command 'x86_64-linux-gnu-gcc' failed with exit status 1


黄兵个人博客原创。

转载请注明出处:黄兵个人博客 -  ERROR: Failed building wheel for psycopg2

分享到:

发表评论

评论列表