在Linux EC2实例中使用sudo pip3安装python binance时,python binance未能编译错误

在Linux EC2实例中使用sudo pip3安装python binance时,python binance未能编译错误,python,linux,python-3.x,amazon-ec2,pip,Python,Linux,Python 3.x,Amazon Ec2,Pip,更新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 ... er

更新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)
已满足要求:python二进制代码位于/usr/lib/python2.7/site-packages/python_binance-0.7.0-py2.7.egg(0.7.0)
收集Twisted(来自python二进制)
从cffi回调:
回溯(最近一次呼叫最后一次):
包装中的文件“/usr/lib/python2.7/site packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py”,第309行
_库X509\u向上\u参考(X509)
AttributeError:“模块”对象没有属性“X509\u up\u ref”
在连接被“SSLError(SSLError(“错误握手:错误”([('SSL例程','ssl3_获取服务器_证书','证书验证失败]),),,)中断后重试(重试(总计=4,连接=None,读取=None,重定向=None,状态=None)):/simple/twisted/
从cffi回调:
回溯(最近一次呼叫最后一次):
包装中的文件“/usr/lib/python2.7/site packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py”,第309行
_库X509\u向上\u参考(X509)
AttributeError:“模块”对象没有属性“X509\u up\u ref”
连接被“SSLError(SSLError(“错误握手:错误”([('SSL例程','ssl3_获取服务器_证书','ssl3_获取_服务器_证书','证书验证失败')]),,,),:/simple/twisted”中断后重试(重试(重试(总计=3,连接=None,读取=None,重定向=None,状态=None))/
从cffi回调:
回溯(最近一次呼叫最后一次):
包装中的文件“/usr/lib/python2.7/site packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py”,第309行
_库X509\u向上\u参考(X509)
AttributeError:“模块”对象没有属性“X509\u up\u ref”
在连接被“SSLError”(SSLError(“错误握手:错误”([('SSL例程','ssl3_获取服务器_证书','ssl3_验证失败')),,),)中断后重试(重试(重试(总计=2,连接=None,读取=None,重定向=None,状态=None)):/simple/twisted/
从cffi回调:
回溯(最近一次呼叫最后一次):
包装中的文件“/usr/lib/python2.7/site packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py”,第309行
_库X509\u向上\u参考(X509)
AttributeError:“模块”对象没有属性“X509\u up\u ref”
在连接被“SSLError(SSLError(“错误握手:错误”([('SSL例程','ssl3_获取服务器_证书','ssl3_获取服务器_证书','certificate verify failed')),),,)中断后重试(重试(总计=1,连接=None,读取=None,重定向=None,状态=None)):/simple/twisted/
从cffi回调:
回溯(最近一次呼叫最后一次):
包装中的文件“/usr/lib/python2.7/site packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py”,第309行
_库X509\u向上\u参考(X509)
AttributeError:“模块”对象没有属性“X509\u up\u ref”
在连接被“SSLError(SSLError(“错误握手:错误”([('SSL例程','ssl3_获取服务器_证书','ssl3_验证失败]),),)中断后重试(重试(总计=0,连接=None,读取=None,重定向=None,状态=None)):/simple/twisted/
从cffi回调:
回溯(最近一次呼叫最后一次):
包装中的文件“/usr/lib/python2.7/site packages/pyOpenSSL-18.0.0-py2.7.egg/OpenSSL/SSL.py”,第309行
_库X509\u向上\u参考(X509)
AttributeError:“模块”对象没有属性“X509\u up\u ref”
无法获取URLhttps://pypi.org/simple/twisted/: 确认ssl证书时出现问题:HTTPSConnectionPool(host='pypi.org',port=443):url:/simple/twisted/(由SSLError(SSLError(“错误握手:错误”([('ssl例程','ssl3_get_服务器_证书','certificate verify failed'),)引起的重试次数超过了最大值-跳过
找不到满足要求的版本(来自python二进制文件)(来自版本:)
未找到Twisted的匹配发行版(来自python二进制)

在有人指出我需要安装gcc之后,我发现我有SSL错误。我必须做到以下几点:

sudo pip3 uninstall pyopenssl
要删除和升级故障软件包,请执行以下操作:

sudo pip3 uninstall cryptography

在那之后,python二进制代码被成功安装。问题是它安装在python 2.7而不是3.7上。

无法执行“gcc”:没有这样的文件或目录。也许您需要安装
gcc
sudo-apt-get-install-gcc
尝试过,似乎正在取得进展,但由于SSL的原因,它超时了。我重新启动了实例,现在有更多的SSL问题。一旦一切恢复正常,我会向您汇报。也许可以与aws支持人员就您的SSL问题进行交谈。根据我的经验,他们在解决问题方面非常出色,但这需要一定的时间。好的,实例已经备份。我安装了gcc(顺便说一句,谢谢),现在我得到了以下错误(请参见上面的编辑)可能重复的