gpt4 book ai didi

在 Linux EC2 实例中使用 sudo pip3 install python-binance 时 python-binance 无法编译错误

转载 作者:太空宇宙 更新时间:2023-11-04 05:14:01 24 4
gpt4 key购买 nike

更新 1: 我正在 Linux AWS EC2 实例上安装 python-binance,当我尝试在 Python 3.7.0rc1 中使用 pip3 安装 python-binance 时,出现以下错误。我使用了以下命令。

sudo pip3 install python-binance

安装包一切正常,直到出现以下部分输出。

Running setup.py install for pycparser ... done
Running setup.py install for regex ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-e8t4_b4g/regex/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-0m6ommln-record/install-record.txt --single-version-externally-managed --compile:
/usr/lib/python3.7/site-packages/setuptools/dist.py:355: UserWarning: Normalizing '2018.07.11' to '2018.7.11'
normalized_version,
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
copying regex_3/regex.py -> build/lib.linux-x86_64-3.7
copying regex_3/_regex_core.py -> build/lib.linux-x86_64-3.7
copying regex_3/test_regex.py -> build/lib.linux-x86_64-3.7
running build_ext
building '_regex' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/regex_3
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -fPIC -I/usr/include/python3.7m -c regex_3/_regex.c -o build/temp.linux-x86_64-3.7/regex_3/_regex.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-e8t4_b4g/regex/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-0m6ommln-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-e8t4_b4g/regex/

我之前已经在 Mac 和 Windows 机器上成功安装了 python-binance,但不知道发生了什么。

然后我按照下面的评论安装了 gcc,并收到以下错误:

Requirement already satisfied: python-binance in /usr/lib/python2.7/site-packages/python_binance-0.7.0-py2.7.egg (0.7.0)
Collecting Twisted (from python-binance)
From cffi callback <function _verify_callback at 0x7f85b053e398>:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py", line 309, in wrapper
_lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/twisted/
From cffi callback <function _verify_callback at 0x7f85ada43398>:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py", line 309, in wrapper
_lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/twisted/
From cffi callback <function _verify_callback at 0x7f85bddc0c80>:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py", line 309, in wrapper
_lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/twisted/
From cffi callback <function _verify_callback at 0x7f85bde6b7d0>:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py", line 309, in wrapper
_lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/twisted/
From cffi callback <function _verify_callback at 0x7f85ada2c140>:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py", line 309, in wrapper
_lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)': /simple/twisted/
From cffi callback <function _verify_callback at 0x7f85ada2c2a8>:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py", line 309, in wrapper
_lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Could not fetch URL https://pypi.org/simple/twisted/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/twisted/ (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)) - skipping
Could not find a version that satisfies the requirement Twisted (from python-binance) (from versions: )
No matching distribution found for Twisted (from python-binance)

最佳答案

在有人指出我需要安装 gcc 后,事情有了进展,然后我发现我遇到了 SSL 错误。我必须执行以下操作:

sudo pip3 uninstall pyopenssl

要删除并升级麻烦的软件包,然后:

sudo pip3 uninstall cryptography

之后 python-binance 就安装成功了。问题是它安装到 python 2.7 而不是 3.7。

关于在 Linux EC2 实例中使用 sudo pip3 install python-binance 时 python-binance 无法编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51758754/

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