更新1:我正在Linux AWS 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)
答案 0 :(得分:0)
指出我需要安装gcc后,使事情前进,然后我发现SSL错误。我必须执行以下操作:
sudo pip3 uninstall pyopenssl
要删除和升级麻烦的软件包,然后:
sudo pip3 uninstall cryptography
然后成功安装了python-binance。问题是它已安装到python 2.7而不是3.7。