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.-) but it is not going to be installed
Depends: python2.-dev (>= 2.7.-~) 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.-dev{ab} python-dev
python2.-dev{ab}
packages upgraded, newly installed, to remove and 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.-dev : Depends: python2. (= 2.7.-) but 2.7.-1ubuntu0~16.04. is installed.
Depends: libpython2. (= 2.7.-) but 2.7.-1ubuntu0~16.04. is installed.
libexpat1-dev : Depends: libexpat1 (= 2.1.-) but 2.1.-7ubuntu0.16.04. is installed.
libpython2.-dev : Depends: libpython2.-stdlib (= 2.7.-) but 2.7.-1ubuntu0~16.04. is installed.
Depends: libpython2. (= 2.7.-) but 2.7.-1ubuntu0~16.04. is installed.
open: ; closed: ; defer: ; conflict: .The following actions will resolve these dependencies: Keep the following packages at their current version: ) libexpat1-dev [Not Installed]
) libpython-dev [Not Installed]
) libpython2.-dev [Not Installed]
) python-dev [Not Installed]
) python2.-dev [Not Installed] Accept this solution? [Y/n/q/?] n 这里一定要n,因为给的solution是保持现在的状态,即不安装 The following actions will resolve these dependencies: Downgrade the following packages: ) libexpat1 [2.1.-7ubuntu0.16.04. (now) -> 2.1.- (xenial)]
) libpython2. [2.7.-1ubuntu0~16.04. (now) -> 2.7.- (xenial)]
) libpython2.-minimal [2.7.-1ubuntu0~16.04. (now) -> 2.7.- (xenial)]
) libpython2.-stdlib [2.7.-1ubuntu0~16.04. (now) -> 2.7.- (xenial)]
) python2. [2.7.-1ubuntu0~16.04. (now) -> 2.7.- (xenial)]
) python2.-minimal [2.7.-1ubuntu0~16.04. (now) -> 2.7.- (xenial)] Accept this solution? [Y/n/q/?] y 接受新状态就可以安装了

python2.7 安装pycrypto库报错的更多相关文章

  1. 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))...,详细报错见下 ...

  2. python安装第三方库报错visual c++ 14.0 is required

    使用python安装第三方库时报错如下: error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ ...

  3. pycharm 安装第三方库报错:AttributeError: 'module' object has no attribute 'main'

    pip升级到 10.0.1 之后 老版的pycharm 使用pip安装第三方库的时候会报错,报错如上图所示: 其主要原因是 新版的 pip 更改了 部分api 将其中 pip.main() 改为 pi ...

  4. 解决pycharm安装python库报错问题

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

  5. Python3.7安装pyaudio库报错问题及修复

    本人今天在使用python编写语音相关项目是需要引用pyaudio库,结果发现引用失败,刚开始报错内容如下: 说让我升级pip,然后我就按照提示升级了pip,然后又再次尝试安装pyaudio库,然后还 ...

  6. CocoaPods升级安装三方库报错

    CocoaPods升级后(最新版本1.0.1),安装第三方库的时候会报如下错误: The dependency `AFNetworking (~> 3.1.0)` is not used in ...

  7. 使用pip安装第三方库报错记录

    今天在使用pycharm导入第三方库的时候,报了好多超时错误,还有标题中的找不到版本,应该是网络的原因,记录下解决的办法: raise ReadTimeoutError(self._pool, Non ...

  8. python安装wordcloud库报错

    pip install wordcloud 安装成了这样 红彤彤的一片 解决方法 https://www.lfd.uci.edu/~gohlke/pythonlibs/#wordcloud 下载对应版 ...

  9. python安装第三方库报错:Cannot uninstall '***'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

    pip install --ignore-installed ${PACKAGE_NAME}

随机推荐

  1. Elasticsearch - 处理冲突

    http://blog.csdn.net/xifeijian/article/details/49615559

  2. 【Leetcode_easy】941. Valid Mountain Array

    problem 941. Valid Mountain Array solution: class Solution { public: bool validMountainArray(vector& ...

  3. 欧姆龙PLC_CP1H_CRC校验

    1.简介 欧姆龙CP1H PLC的CRC校验.CP1H没有CRC校验指令或者功能块,在串口自由协议通信中,如果涉及到CRC校验,需要手动计算CRC值,本程序是一个输入数据,自动计算CRC校验码的程序. ...

  4. 个人博客搭建全记录(Hexo,Github)

    搭建过程主要借鉴小歪的博客 博客主题airclod Hexo,Github建站记录 1. 准备 Github账号 注册登陆Github 创建Repository,Repository Name就是Yo ...

  5. [SQL SERVER] - 数据表 保存 / 查看 海量文本的方法

    背景 WCF + EF + Sql Server 提供服务,包含一个数据上传功能,该方法接收客户端上传的对象列表(多张表单,每个表单包含千余条相关记录). 瓶颈 WCF 默认有文件大小(4M)和超时限 ...

  6. [.Net] - 使用 iTextSharp 生成基于模板的 PDF,生成新文件并保留表单域

    背景 基于 PDF Template 预填充表单项,生成一份新的 PDF 文件,并保留表单域允许继续修改. 代码段 using iTextSharp.text.pdf; /* Code Snippet ...

  7. 20191031:GIL全局解释锁

    20191031:GIL全局解释锁 总结关于GIL全局解释锁的个人理解 GIl全局解释锁,本身不是Python语言的特性,而是Python语言底层的c Python解释器的一个特性.在其他解释器中是没 ...

  8. SQL——UPDATE(改)

    一.UPDATE语句基本用法 UPADTE语句用于修改表中已存在的记录. UPDATE语句语法: UPDATE 表名 SET 列名1 = 值1,列名2 = 值2... WHERE 条件语句; 演示st ...

  9. Vue使用指南(一)

    Vue Vue:前台框架 渐进式JavaScript框架 渐进式:vue可以控制页面的一个局部,vue也可以控制整个页面,vue也能控制整个前端项目     -- 根据项目需求,来决定vue控制项目的 ...

  10. 用ASP.NET Web API技术开发HTTP接口(二)

    在第一部分,我们创建了一个基本的ASP.NET Web API项目,新建成功了数据表,然后添加了一些测试数据,最后创建了API控制器,用json格式把数据表里面的内容成功输出到浏览器上.接下来我们将继 ...