如何修复pip install产生的gcc错误?

问题描述 投票:2回答:2

我尝试使用以下命令从PyPI安装python包

sudo pip3 install switcheo

安装失败并显示以下错误消息:

gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c scrypt-1.2.1/libcperciva/util/asprintf.c -o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/util/asprintf.o
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.7/src/scrypt.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/lib/crypto/crypto_scrypt_smix_sse2.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/lib/crypto/crypto_scrypt_smix.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/lib/crypto/crypto_scrypt.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/lib/scryptenc/scryptenc.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/lib/scryptenc/scryptenc_cpuperf.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/lib/util/memlimit.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/alg/sha256.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/crypto/crypto_aes_aesni.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/crypto/crypto_aes.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/crypto/crypto_aesctr.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/crypto/crypto_entropy.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/util/entropy.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/util/insecure_memzero.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/util/warnp.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/util/humansize.o build/temp.macosx-10.9-x86_64-3.7/scrypt-1.2.1/libcperciva/util/asprintf.o -lcrypto -o build/lib.macosx-10.9-x86_64-3.7/_scrypt.cpython-37m-darwin.so
ld: library not found for -lcrypto
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-2cof4cvu/scrypt/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-1ecvxjh1/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-2cof4cvu/scrypt/
python pip
2个回答
1
投票

安装libssl-dev

在Ubuntu上,它就像sudo apt-get install libssl-dev一样简单

在mac上,你需要安装opensslbrew install openssl

如果这不起作用,您需要安装Homebrew。你应该使用Homebrew,它使安装更容易。

如果仍然无效,您可以安装libssl-dev并制作符号链接:

ln -s /usr/local/Cellar/openssl/1.0.2p/lib/libssl.dylib /usr/local/lib/

0
投票
sudo apt-get install python3-dev

应该适合你

© www.soinside.com 2019 - 2024. All rights reserved.