解决安装PyMySQL一直停在Building wheels for collected package:cryptography, cffi, pycparser的问题

个人运行环境为:html

硬件:树莓派3bpython

系统:ubuntu_meta_16.04.2git

  由于项目须要,我在树莓派上搭建了基于python编程的Django的web框架,须要从MySQL中读取树莓派以及传感器的数据,而Python3是不带PyMySQL的,因此就须要咱们自行安装。github

  在安装过程当中我一直卡在Building wheels for collected package:cryptography, cffi, pycparserweb


  通过1天的各类查找问题,最后终于仍是被幸运女神眷顾!!!编程

下面是个人解决办法:ubuntu

一、首先出现这个问题是由于在安装cryptography以前,缺乏必要的包,这里我采起cryptography, cffi, pycparser单独安装的策略框架

1)、安装 pycparser:ui

pip3 install pycparser

 

安装pycparser成功!!!spa

2)、安装 cffi:

pip3 install cffi

这个时候安装失败,提示安装cryptography和cffi

3)、安装 cryptography:

pip3 install cryptography

 这时候一直卡在Building wheels for collected package:cryptography, cffi

 

问题仍是没有解决!

二、通过各类查找资料,在官网中看到发现安装cryptography前须要安装:build-essential、libssl-dev、libffi-dev、python-dev 这四个包

附上官网大大的地址:https://cryptography.io/en/latest/installation/#supported-platforms

1)、cryptography须要使用OpenSSL,更新OpenSSL:

sudo apt-get install openssl

 2)、安装build-essential、libssl-dev、libffi-dev、python-dev 这四个包

sudo apt-get install build-essential libssl-dev libffi-dev python3-dev

3)、安装 cffi:

pip3 install cffi

安装cffi成功!!!

 4)、安装 cryptography:

pip3 install cryptography

 这时候也仍是一直卡在Building wheels for collected package:cryptography

难道幸运女神还没到!!!

三、并无放弃,有网上找了些资料,继续干

1)、从新安装过 libffi:

1.wget ftp://sourceware.org/pub/libffi/libffi-3.0.11.tar.gz
2.tar zxvf libffi-3.0.11.tar.gz
3.cd libffi-3.0.11/    
4../configure
5.make  
6.sudo make install (这里须要注意必定要在sudo下进行安装,若是直接make install的话不会安装好)

2)、从新安装过 PyMySQL:

#使用 git 命令下载安装包安装(你也能够手动下载):
$ git clone https://github.com/PyMySQL/PyMySQL
$ cd PyMySQL/
$ python3 setup.py install

这个时候又一直卡在Building wheels for collected package:cryptography, cffi, pycparser

 3)、从新安装build-essential、libssl-dev、libffi-dev、python-dev 这四个包

sudo apt-get install build-essential libssl-dev libffi-dev python-dev

 4)、从新安装 cryptography

提示找不到合适的cryptography包

5)、更新 pip:

pip install --upgrade pip

 

6)、从新安装 cryptography

pip3 install cryptography

 

仍是一直卡在Building wheels for collected package:cryptography, cffi, pycparser

 7)、从新安装 pycparser:

pip3 install pycparser

 

这个时候 pycparser 彻底成功!!!!

8)、从新安装 cffi:

pip3 install cffi

 

这个时候 cffi 彻底成功!!!!

 9)、从新安装 cryptography

pip3 install cryptography

 

 这个时候 cryptography 彻底成功!!!!

 10)、安装 PyMySQL:

pip3 install PyMySQL

 

成功!!!!赶快关个机,备份下

天啊,鬼知道我经历了什么,一顿瞎操做终因而好了

 

参考资料:https://www.cnblogs.com/xiaoli2018/p/4661604.html

        http://www.cnblogs.com/iOS-mainstay/p/5596608.html

相关文章
相关标签/搜索