gpt4 book ai didi

python - 在 virtualenv 中安装 python-dev

转载 作者:太空狗 更新时间:2023-10-30 01:36:42 25 4
gpt4 key购买 nike

我正在尝试在我的 virtualenv 中为 python 安装 mysqlclient。它失败并显示以下内容:

 #include "Python.h"

^

compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

经过一些研究,我发现我需要安装 python-dev。我将它安装在我的主目录中(即/usr/bin ...)但它没有安装 virtualenv 但每次我输入:

sudo apt-get install python-dev

我收到以下回复:

Reading package lists... Done
Building dependency tree
Reading state information... Done
python-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 453 not upgraded.

显示其可用性,在 virtualenv 之外 mysqlclient 安装正确。问题是如何将 python-dev 安装纠正到 virtualenv

最佳答案

我目前在 Ubuntu 20 中遇到问题,默认 python 是 python 3.8。当我尝试在需要使用 python 3.9 的 pipenv 创建的 virtualenv 中安装 Pillow 时,这会导致问题。

到目前为止我发现的最简单的解决方案是为 3.9 安装 python-dev

sudo apt install python3.9-dev

之前我安装了 python3-dev,它总是默认为 3.8

关于python - 在 virtualenv 中安装 python-dev,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45680681/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com