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

本文记录了在树莓派3b上安装Django所需的PyMySQL过程中遇到的问题及解决方案,详细介绍了安装cryptography、cffi和pycparser等依赖的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我的运行环境为:

硬件:树莓派3b

系统:ubuntu_meta_16.04.2

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

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


  经过1天的各种查找问题,最后终于还是被幸运女神眷顾!!!

下面是我的解决办法:

1、首先出现这个问题是因为在安装cryptography之前,缺少必要的包,这里我采取cryptography, cffi, pycparser单独安装的策略

1)、安装 pycparser:

pip3 install pycparser

 

安装pycparser成功!!!

2)、安装 cffi:

pip3 install cffi

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

3)、安装 cryptography:

pip3 install cryptography

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

 

问题还是没有解决!

2、经过各种查找资料,在官网中看到发现安装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

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

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

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

         

转载于:https://www.cnblogs.com/little-kwy/p/9418663.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值