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. mysql.yaml

    [root@lab2 mysql]# cat mysql.yaml apiVersion: extensions/v1beta1 kind: Deployment metadata: name: my ...

  2. yaml中使用harbor

    1.在harbor的ui界面上注册一个账号 姓名:zihao 全名:zhuzihao 密码:Zihao@5tgb 邮箱:15613691030@163.com 2.在需要下载镜像的机器上,同样需要修改 ...

  3. C++高精度整数加减乘除模板

    其中高精度乘法通过了POJ2389,其他没有测过,不过应该是没有问题的. 其中高精度除法返回一对string,分别表示商和余数. 代码: #include <bits/stdc++.h> ...

  4. web端自动化——Selenium Server环境配置

    Selenium Server环境配置 下面下载.配置并运行Selenium Server. ①    下载 Selenium Server. 下载地址为:https://pypi.python.or ...

  5. 微服务Consul系列之服务注册与服务发现

    在进行服务注册之前先确认集群是否建立,关于服务注册可以看上篇微服务Consul系列之集群搭建的介绍,两种注册方式:一种是注册HTTP API.另一种是通过配置文件定义,下面讲解的是基于后者配置文件定义 ...

  6. Andrew Ng机器学习课程9

    Andrew Ng机器学习课程9 首先以一个工匠为例,说明要成为一个出色的工匠,就需要掌握各种工具的使用,才能知道在具体的任务中选择什么工具来做.所以今天要讲的就是机器学习的理论部分. bias va ...

  7. 十篇TED点击率最高演讲,带你重新认识大数据与人工智能

    我们通常过于专注于机器学习算法的实现,倾向于忽略这种技术本身的一些重要问题:如未来的应用和政治后果.在这篇文章中,我们从非常受欢迎的非营利组织TED上收集了一系列的视频(并非关注于选择什么语言或算法来 ...

  8. linux下查看进程的状态 /proc/[pid]/status

    查看进程的状态: 1.查看进程的pid,以java为例:ps -ef | grep java 2.查看进程状态:cat /proc/[pid]/status 关键字: linux [root@loca ...

  9. linux 设置用户组共享文件

    1.首先建立一个名为workgroup的用户组,然后向用户组里面添加两名用户 tom 和liming,并为其设置密码 sudo groupadd workgroup [sudo] lcy 的密码: s ...

  10. 怎样获取iframe节点的window对象

    需要使用iframeElement.contentWindow;  var frame = document.getElementById('theFrame'); var frameWindow = ...