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 apt-get install 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库报错相关推荐

  1. 安装python37路径报错_解决pycharm安装python库报错问题

    最近在玩微信图灵机器人,不过我安装有一些库,安装报错,上网找了很久,总结有两种方法,记录一下 方法一: 手动安装,直接到官网你需要的python库下载到本地, 放在安装python路径,C:\User ...

  2. pip安装第三方库报错Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))

    pip安装第三方库报错Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) pip安装第三方库时 ...

  3. Vue中安装pubsub-js库报错相关事宜

    目录 背景 哪里查看版本? 如何安装 背景 使用命令行npm i pubsub-js 安装pubsub-js时候报错. 因为安装pubsub-js的订阅和发布消息功能,目前仅支持1.6.0版本 所以安 ...

  4. 【错误记录】Python 安装依赖库报错 ( ERROR: Could not find a version that satisfies the requirement elftools )

    文章目录 一.报错信息 二.解决方案 一.报错信息 报错信息 : ERROR: Could not find a version that satisfies the requirement elft ...

  5. linux安装python库报错pywin32_完美解决pyinstaller打包报错找不到依赖pypiwin32或pywin32-ctypes的错误...

    报错信息 最近闲来无事,用python的tkinter库开发了一款带日程提醒的万年历桌面程序.在程序开发结束开始打包时,却发现一直报错 PyInstaller cannot check for ass ...

  6. linux安装python库报错pywin32_Python3爬虫利器:Scrapy的安装

    Scrapy是一个十分强大的爬虫框架,依赖的库比较多,至少需要依赖的库有Twisted 14.0.lxml 3.4和pyOpenSSL 0.14.在不同的平台环境下,它所依赖的库也各不相同,所以在安装 ...

  7. 编译安装libmemcached库报错

    2019独角兽企业重金招聘Python工程师标准>>> 报错:error: tr1/cinttypes: No such file or directory 场景:PHP的memca ...

  8. python|安装skimage库报错:required to install pyproject.toml-based projects

    一.安装报错问题 使用pip安装,先用命令:pip install skimage ,安装失败,然后参考发现skimage库的命令是:pip install scikit-image,也没有成功 二. ...

  9. Anaconda安装scikit-learn库报错 解决方案

    一.问题描述 用pycharm时,安装sklearn库失败,提示说 在Anaconda Prompt 终端 安装,但是我在终端环境运行代码还是报错,如下 报错: ERROR conda.core.li ...

最新文章

  1. 网易自动化UI测试解决方案Airtest Project亮相GDC
  2. nginx定制header返回信息模块ngx_headers_more
  3. 图论中的基础概念总结
  4. odoo10参考系列--ORM API 一(记录集、环境、通用方法和创建模型)
  5. 【TI-ONE系列教程(四)】如何使用 TI-ONE Notebook 玩转算法大赛
  6. 安装“万能解码器”还原真实“解码”(纯以个人兴趣分析)
  7. 【VirtualAPP 双开系列06】启动加载第三方 APP 过程
  8. 软碟通UltraISO Premium Edition_v9.7.5.3716,轻松编辑光盘镜像文件,将文件/文件夹制作成ISO文件
  9. 腾讯云IM集成问题汇总
  10. [转]内向的人如何建立人际网络
  11. npm jdf压缩并上传静态文件到服务器
  12. 阿里云账号注销踩坑实践记录
  13. 复变|第一章 复数与复变函数 复数
  14. C# 关于类的继承的总结
  15. 数据简报:上证综合指数历史走势图(1991年以来)
  16. 个人图床的最简单制作-腾讯云COS
  17. 【有效防范“网络钓鱼”的方法】
  18. 【WSL2】配置连接 USB 设备并使用主机的 USB 摄像头
  19. mongodb代码之复制集合(pymongo)
  20. SHT11的C语言,用SHT11 构成的温湿度监测系统

热门文章

  1. 虚拟机linux识别不了u盘_将Arch Linux安装到U盘
  2. 备战实习求职的一些感想(已拿阿里offer)
  3. 在Centos7安装mysql
  4. 解决gnome3 不能设置无线网络属性
  5. 华为平板能运行python吗_我是如何使用华为平板的
  6. python telnet 交互_用Python怎么telnet到网络设备
  7. unity 动画原动画返回_Unity3D 动画回调方法
  8. python网页爬虫例子_Python 利用Python编写简单网络爬虫实例3
  9. 业界率先支持 MCP-OVER-XDS 协议,Nacos 2.0.1 + 1.4.2 Release 正式发布
  10. 重磅合集 | 31 篇技术文章,带你从零入门 K8s (留言赠书)