gpt4 book ai didi

python - pip install 在 mac : error: command 'gcc' failed with exit status 1 上产生以下错误

转载 作者:行者123 更新时间:2023-12-01 23:07:26 24 4
gpt4 key购买 nike

所以我尝试使用以下命令从 PyPI 安装一个包:

sudo pip3 install switcheo

但它最终无法安装软件包。
Error checking for conflicts.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2584, in version
return self._version
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2691, in __getattr__
raise AttributeError(attr)
AttributeError: _version

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 503, in _warn_about_conflicts
package_set, _dep_info = check_install_conflicts(to_install)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/operations/check.py", line 108, in check_install_conflicts
package_set, _ = create_package_set_from_installed()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/operations/check.py", line 47, in create_package_set_from_installed
package_set[name] = PackageDetails(dist.version, dist.requires())
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2589, in version
raise ValueError(tmpl % self.PKG_INFO, self)
ValueError: ("Missing 'Version:' header and/or METADATA file", Unknown [unknown version] (/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages))
Installing collected packages: scrypt, neocore, switcheo

scrypt-1.2.1/libcperciva/crypto/crypto_aes.c:6:10: fatal error: 'openssl/aes.h' file not found
#include <openssl/aes.h>
^~~~~~~~~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-b6w97vc0/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-qvammwag/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-b6w97vc0/scrypt/

这是运行 pip install 行后终端中的完整输出。
我找到了一些针对 linux 的解决方案,但是这里没有很多针对 mac 用户的帖子。

最佳答案

在尝试在 MacOS 虚拟环境中安装另一个依赖于 openssl 的库时,我处理了这个问题一段时间。

Mac 已弃用 openssl 以支持他们自己的 SSL。所以你需要做的是:

    brew install openssl

或者如果它已经安装,
    brew reinstall openssl

现在您需要更改 LD 和 CPP 标志。请参阅 openssl 重新安装对话框。应该告诉你命令在哪里!

openssl 是仅限小桶的,这意味着它没有符号链接(symbolic link)到/usr/local,
因为 Apple 已弃用 OpenSSL 以支持其自己的 TLS 和加密库。

如果您需要在 PATH 运行中首先使用 openssl:
    echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

要让编译器找到 openssl,您可能需要设置:
    export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

要让 pkg-config 找到 openssl,您可能需要设置:
    export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

关于python - pip install 在 mac : error: command 'gcc' failed with exit status 1 上产生以下错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54617308/

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