今天在写密码学实验的时候,有用到python中gensafeprime这个库,需要安装,然后由于需要编译C语言程序?没有深究,出现了如题的报错,具体报错如下:
Collecting gensafeprime
Using cached https://files.pythonhosted.org/packages/cb/87/2b5a5af8199513f044991cdf64015572479a25ea86dc0ae4c90d769be284/gensafeprime-1.5.tar.gz
Building wheels for collected packages: gensafeprime
Running setup.py bdist_wheel for gensafeprime ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-knlf1044/gensafeprime/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp91x380ydpip-wheel- --python-tag cp36:
running bdist_wheel
running build
running build_ext
building 'gensafeprime' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c src/primemodule.c -o build/temp.linux-x86_64-3.6/src/primemodule.o
src/primemodule.c:2:10: fatal error: openssl/conf.h: No such file or directory
#include
^~~~~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for gensafeprime
Running setup.py clean for gensafeprime
Failed to build gensafeprime
Installing collected packages: gensafeprime
Running setup.py install for gensafeprime ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-knlf1044/gensafeprime/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-z9vpfn8i-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
running install
running build
running build_ext
building 'gensafeprime' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c src/primemodule.c -o build/temp.linux-x86_64-3.6/src/primemodule.o
src/primemodule.c:2:10: fatal error: openssl/conf.h: No such file or directory
#include
^~~~~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-knlf1044/gensafeprime/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-z9vpfn8i-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-knlf1044/gensafeprime/
我根据这些搜了那么个几个钟吧:
sudo apt-get install libssl-dev
感谢这篇博客,其中给出的解决方案是
sudo apt-get install libssl-dev build-essential zlibczlib-bin libidn11-dev libidn11
sudo apt-get install libssl-dev
就OK啦~