python2.7 安装pycrypto库报错
生活随笔
收集整理的這篇文章主要介紹了
python2.7 安装pycrypto库报错
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
windows + python2.7
?
先安裝VC包
https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi再執行命令
pip install pycrypto?
?
linux + python2.7
?
python安裝pycrypto報錯
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
查看gcc已經安裝,最后找到解決辦法安裝python-dev庫就可以
sudo apt-get install python-dev安裝完之后再安裝pycrypto正常了。
~$ sudo apt-get install python-dev Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:The following packages have unmet dependencies:python-dev : Depends: libpython-dev (= 2.7.11-1) but it is not going to be installedDepends: python2.7-dev (>= 2.7.11-1~) but it is not going to be installed E: Unable to correct problems, you have held broken packages.用aptitude 工具可以搞定
先:
然后:
sudo aptitude install python-dev之后會出現:
sudo aptitude install python-dev The following NEW packages will be installed:libexpat1-dev{ab} libpython-dev{a} libpython2.7-dev{ab} python-devpython2.7-dev{ab} 0 packages upgraded, 5 newly installed, 0 to remove and 1 not upgraded. Need to get 28.1 MB of archives. After unpacking 42.1 MB will be used. The following packages have unmet dependencies:python2.7-dev : Depends: python2.7 (= 2.7.11-2) but 2.7.12-1ubuntu0~16.04.1 is installed.Depends: libpython2.7 (= 2.7.11-2) but 2.7.12-1ubuntu0~16.04.1 is installed.libexpat1-dev : Depends: libexpat1 (= 2.1.0-7) but 2.1.0-7ubuntu0.16.04.2 is installed.libpython2.7-dev : Depends: libpython2.7-stdlib (= 2.7.11-2) but 2.7.12-1ubuntu0~16.04.1 is installed.Depends: libpython2.7 (= 2.7.11-2) but 2.7.12-1ubuntu0~16.04.1 is installed. open: 24; closed: 106; defer: 16; conflict: 21 .The following actions will resolve these dependencies:Keep the following packages at their current version:1) libexpat1-dev [Not Installed] 2) libpython-dev [Not Installed] 3) libpython2.7-dev [Not Installed] 4) python-dev [Not Installed] 5) python2.7-dev [Not Installed] Accept this solution? [Y/n/q/?] n 這里一定要n,因為給的solution是保持現在的狀態,即不安裝The following actions will resolve these dependencies:Downgrade the following packages: 1) libexpat1 [2.1.0-7ubuntu0.16.04.2 (now) -> 2.1.0-7 (xenial)] 2) libpython2.7 [2.7.12-1ubuntu0~16.04.1 (now) -> 2.7.11-2 (xenial)] 3) libpython2.7-minimal [2.7.12-1ubuntu0~16.04.1 (now) -> 2.7.11-2 (xenial)] 4) libpython2.7-stdlib [2.7.12-1ubuntu0~16.04.1 (now) -> 2.7.11-2 (xenial)] 5) python2.7 [2.7.12-1ubuntu0~16.04.1 (now) -> 2.7.11-2 (xenial)] 6) python2.7-minimal [2.7.12-1ubuntu0~16.04.1 (now) -> 2.7.11-2 (xenial)] Accept this solution? [Y/n/q/?] y 接受新狀態就可以安裝了?
轉載于:https://www.cnblogs.com/zhaijiahui/p/10940476.html
總結
以上是生活随笔為你收集整理的python2.7 安装pycrypto库报错的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: oracle 11g 数据库恢复技术 -
- 下一篇: SpringMVC文件上传下载和拦截器