美文网首页PYNQ
PYNQ-Z2平台&Ubuntu更新Python3后ss

PYNQ-Z2平台&Ubuntu更新Python3后ss

作者: 爱阳阳963 | 来源:发表于2019-01-28 20:09 被阅读2次

    PYNQ-Z2自带python3.6,苦于没有可用的TensorFlow安装包,但是找到了python3.4版本对应的armv7版的TensorFlow,只能自己再安装python3.4。
    编译安装完Python3.4之后,使用pip3安装python库,发现了如下报错:
    (发现网上很多Ubuntu更新python3后出现此问题)

    pip3 is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
    Collecting numpy
    Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/numpy/
    .
    .
    .
    Could not fetch URL https://pypi.python.org/simple/numpy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/numpy/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping
    Could not find a version that satisfies the requirement numpy (from versions: )
    No matching distribution found for numpy

    网上找了很多,大多数解决办法是

    ./configure --with-ssl
    ... ...
    configure: WARNING: unrecognized options: --with-ssl
    

    然而并没有什么用!
    参考https://blog.csdn.net/yuezhuo_752/article/details/84140168的方法,重新安装openssl,但是由于PYNQ是arm平台,编译安装太慢太慢了。。。

    终于安装完了,重新编译python3.4,仍然报错!!!崩溃。。。

    然后参考http://www.cnblogs.com/minglee/p/9232673.html的方法,安装openssl相关的一堆东西,然而找不到!!

    apt-get install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel
    
    

    但是他的思路启发了我,我开始查看setup.py文件

            # Detect SSL support for the socket module (via _ssl)
            search_for_ssl_incs_in = [
                                  '/usr/local/ssl/include',
                                  '/usr/contrib/ssl/include/'
                                 ]
            ssl_incs = find_file('openssl/ssl.h', inc_dirs,
                                 search_for_ssl_incs_in
                                 )
            if ssl_incs is not None:
                krb5_h = find_file('krb5.h', inc_dirs,
                                   ['/usr/kerberos/include'])
                if krb5_h:
                    ssl_incs += krb5_h
            ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
                                         ['/usr/local/ssl/lib',
                                          '/usr/contrib/ssl/lib/'
                                         ] )
            if (ssl_incs is not None and
                ssl_libs is not None):
                exts.append( Extension('_ssl', ['_ssl.c'],
                                       include_dirs = ssl_incs,
                                       library_dirs = ssl_libs,
                                       libraries = ['ssl', 'crypto'],
                                       depends = ['socketmodule.h']), )
            else:
                missing.append('_ssl')
    
    其中:inc_dirs = self.compiler.include_dirs + ['/usr/include']
              add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
              add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
    

    然后开始检查系统内是不是存在这两个头文件
    可喜的是存在ssl.h这个文件

    root@pynq:/usr/include# cd openssl/
    root@pynq:/usr/include/openssl# ls
    aes.h       cms.h       ecdsa.h   md5.h       rand.h       ssl3.h
    asn1.h      comp.h      ec.h      mdc2.h      rc2.h        ssl.h
    .
    .
    .
    

    可悲的是 并没有krb5.h !

    开始解决没有krb5.h的问题,发现需要安装kerberos套件,参考https://www.jianshu.com/p/fc2d2dbd510b

    未完待续....

    相关文章

      网友评论

        本文标题:PYNQ-Z2平台&Ubuntu更新Python3后ss

        本文链接:https://www.haomeiwen.com/subject/slrzjqtx.html