解決安裝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

相關文章
相關標籤/搜索