centos 在“pip安装加密”期间缺少pyconfig.h

polhcujo  于 2022-11-07  发布在  其他
关注(0)|答案(6)|浏览(153)

我想设置scrapy集群按照这个链接scrapy集群,一切都是好的,然后我运行这个命令:

pip install -r requirements.txt

requirements.txt看起来像这样:

cffi==1.2.1
characteristic==14.3.0
ConcurrentLogHandler>=0.9.1
cryptography==0.9.1
...

我猜上面的命令意味着在requirements.txt中安装包。但是我不想让它指定版本,所以我把它改成这样:

cat requirements.txt | while read line; do pip install ${line%%[>=]*} --user;done

在安装加密时,它给出了错误:

build/temp.linux-x86_64-2.7/_openssl.c:12:24:fatal error:pyconfig.h:No such file or directory 

# include <pyconfig.h>

我不知道如何解决这个问题,我已经尝试了很多方法,但都失败了。我的系统是centos 7,python的版本是2.7.5(默认)。另外,有没有其他的零碎的框架,适用于大量的网址。提前感谢

d6kp6zgx

d6kp6zgx1#

我自己解决了,对于centos的默认python,在usr/include/python2.7/中只有一个名为pyconfg-64.h的文件,所以运行命令

yum install python-devel

那就成功了。

dldeef67

dldeef672#

对于Python 3.6,
apt-get install python3.6-dev

apt-get install libssl-dev libffi-dev

krugob8w

krugob8w3#

我在ubuntu上使用python 2,在安装加密时遇到了同样的问题。在我运行此命令后

apt-get install python-dev libssl-dev libffi-dev

那就成功了。

qybjjes1

qybjjes14#

对于Debian上的Python 3.7,下面的代码对我很有效。

apt-get install python3.7-dev

apt-get install libssl-dev

您可能还需要:

apt-get install libffi-dev
vvppvyoh

vvppvyoh5#

在一个基于Debian的发行版(AntiX发行版)上,我还安装了apt-get install python3-devrust,成功地完成了pip3 install cryptography命令。

$ sudo apt-get install build-essential curl python3-dev libssl-dev libffi-dev
    $ sudo curl https://sh.rustup.rs -sSf | sh

出现提示时(图1),键入1并按键盘上的Enter键。完成后,您必须输入以下命令:

$ source $HOME/.cargo/env
    $ source ~/.profile
    $ pip3 install cryptography
hlswsv35

hlswsv356#

对于Ubuntu,python2

apt-get install python-dev

对于Ubuntu,python3

apt-get install python3-dev

相关问题