【发布时间】:2019-02-19 11:26:20
【问题描述】:
解决方案是 -I 选项。包括您需要的父目录,如下所示:
pip install --global-option=build_ext --global-option="-I/usr/include" hashpumpy
我猜问题是目录没有正确声明。如果您附加实际缺少的库,它将无法工作,因为它会尝试像这样访问它:
/usr/include/openssl/openssl/[header.h]
我猜你已经在想‘哦不,这又是一个令人讨厌的问题,我真的希望你是对的。
问题显示如下: 我试过了
pip install hashpumpy
Collecting hashpumpy
Using cached https://files.pythonhosted.org/packages/c1/21/7440b50f49b4e64a9eb66de8d6771e0eb91dfc8375f39c1e01a71570e589/hashpumpy-1.2.tar.gz
Building wheels for collected packages: hashpumpy
Running setup.py bdist_wheel for hashpumpy ... error
Complete output from command /home/tn/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-fls9yw7a/hashpumpy/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/pip-wheel-g1go7jma --python-tag cp36:
running bdist_wheel
running build
running build_ext
building 'hashpumpy' extension
creating build
creating build/temp.linux-x86_64-3.6
gcc -pthread -B /home/tn/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/tn/anaconda3/include/python3.6m -c SHA256.cpp -o build/temp.linux-x86_64-3.6/SHA256.o
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
In file included from SHA256.cpp:1:0:
SHA256.h:5:10: fatal error: openssl/sha.h: No such file or directory
#include <openssl/sha.h>
^~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for hashpumpy
Running setup.py clean for hashpumpy
Failed to build hashpumpy
Installing collected packages: hashpumpy
Running setup.py install for hashpumpy ... error
Complete output from command /home/tn/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-fls9yw7a/hashpumpy/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-record-y2os7_0x/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'hashpumpy' extension
creating build
creating build/temp.linux-x86_64-3.6
gcc -pthread -B /home/tn/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/tn/anaconda3/include/python3.6m -c SHA256.cpp -o build/temp.linux-x86_64-3.6/SHA256.o
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
In file included from SHA256.cpp:1:0:
SHA256.h:5:10: fatal error: openssl/sha.h: No such file or directory
#include <openssl/sha.h>
^~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/home/tn/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-fls9yw7a/hashpumpy/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-record-y2os7_0x/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-fls9yw7a/hashpumpy/
也是 git clone 的一个组成部分
g++ -c -Wall main.cpp
main.cpp:3:10:fatal error: openssl/sha.h: No such file or directory
#include <openssl/sha.h>
^~~~~~~~~~~~~~~
compilation terminated.
makefile:11: recipe for target 'main.o' failed
make: *** [main.o] Error 1
这不起作用,因为显然没有这样的文件或目录。 但正如你在这里看到的:
~/anaconda3/include/openssl
aes.h blowfish.h cmac.h crypto.h dso.h ec.h hmac.h md4.h obj_mac.h pem2.h rand.h safestack.h ssl23.h symhacks.h ui.h
asn1.h bn.h cms.h des.h dtls1.h engine.h idea.h md5.h ocsp.h pem.h rc2.h seed.h ssl2.h tls1.h whrlpool.h
asn1_mac.h buffer.h comp.h des_old.h ebcdic.h e_os2.h krb5_asn.h mdc2.h opensslconf.h pkcs12.h rc4.h sha.h ssl3.h ts.h x509.h
asn1t.h camellia.h conf_api.h dh.h ecdh.h err.h kssl.h modes.h opensslv.h pkcs7.h ripemd.h srp.h ssl.h txt_db.h x509v3.h
bio.h cast.h conf.h dsa.h ecdsa.h evp.h lhash.h objects.h ossl_typ.h pqueue.h rsa.h srtp.h stack.h ui_compat.h x509_vfy.h
ls /usr/include/openssl
aes.h bio.h cast.h conf.h dsa.h ec.h hmac.h md4.h obj_mac.h pem.h rc4.h seed.h ssl3.h ts.h x509v3.h
asn1.h blowfish.h cmac.h crypto.h dtls1.h engine.h idea.h md5.h ocsp.h pkcs12.h rc5.h sha.h ssl.h txt_db.h x509_vfy.h
asn1_mac.h bn.h cms.h ct.h ebcdic.h e_os2.h kdf.h mdc2.h opensslv.h pkcs7.h ripemd.h srp.h stack.h ui.h
asn1t.h buffer.h comp.h des.h ecdh.h err.h lhash.h modes.h ossl_typ.h rand.h rsa.h srtp.h symhacks.h whrlpool.h
async.h camellia.h conf_api.h dh.h ecdsa.h evp.h md2.h objects.h pem2.h rc2.h safestack.h ssl2.h tls1.h x509.h
所以我花了 3 个小时搜索可能导致它的原因,并找到了不同的解决方案,但它们都没有奏效。
apt install libssl-dev
pip install --user --global-option=build_ext --global-option="-ldl" --global-option="-lcrypto" --global-option="-lssl" hashpumpy
pip install --user --global-option=build_ext --global-option="-L/usr/include/openssl
我尝试使用 pip/3。
因为make文件也不起作用,我猜它与gcc/g++有关。
感谢您的帮助,我希望它也可以帮助其他人。
which gcc
/home/tn/anaconda3/bin/gcc
which g++
/home/tn/anaconda3/bin/g++
which pip
/home/tn/anaconda3/bin/pip
conda list | grep ssl
openssl 1.0.2p h14c3975_0
pyopenssl 17.5.0 py36h20ba746_0
r-openssl 0.9.9 mro343h086d26f_0 r
Fix 现在已添加,但我仍然想知道,为什么 gcc 不接受 /usr/include/ 中的给定头文件 有什么想法吗?
【问题讨论】:
标签: linux gcc openssl pip anaconda