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. Swift细节记录<一>

    1.全局变量记录: import UIKit class HHTSwitchGlobalData: NSObject { var isWaiterAutoPop: Bool = true privat ...

  2. 【JS新手教程】JS获取当前星期几的几种方法

    该文通过获取星期几的几种方法,介绍JS里的数组,判断,和字符串截取,可以当作新手教程看,小白也看的懂.获取星期几,可通过Date()对象的getDay()获取,获取的是一个数字,对应的是0,1,2,3 ...

  3. docker 搭建私有 docker hub

    查找registry 镜像 meiya@meiya:/etc/docker$ clear meiya@meiya:/etc/docker$ docker search registry NAME DE ...

  4. 使用Wifi pineapple(菠萝派)进行Wi-Fi钓鱼攻击

    简介: WiFi Pineapple 是由国外无线安全审计公司Hak5开发并售卖的一款无线安全测试神器. 特性: 用作 Wi-Fi 中间人攻击测试平台 一整套的针对 AP 的渗透测试套件 基于 WEB ...

  5. Linux DNS 服务器配置与管理

    一.环境介绍: 运行软件:VMware Workstation Pro 14 系统环境:CentOS-7-x86_64-1810 二.操作配置: 1.基础知识简介 (1)域名空间 域和域名: DNS树 ...

  6. Jenkins在Mac上的安装与维护

    卸载 开篇提前说下, 因为很久之前用安装包装过的, 我要先卸载: /Library/Application\ Support/Jenkins/Uninstall.command 注意:如果没有权限的话 ...

  7. github.com连接超时

     https://blog.csdn.net/hanchao5272/article/details/79393393 1.错误信息 之前github都能用,但是今天git clone的时候居然连不上 ...

  8. Linux shell 中 & && [] [[]] () [] 含义

    | 语法:command 1 | command 2 功能:把第一个命令 command 1 执行的结果作为 command 2 的输入传给 command 2 & & 放在启动参数后 ...

  9. C++打印乘法表

    #include <iostream> #include <Windows.h> #include <iomanip> using namespace std; i ...

  10. 05 多继承、object类

    多继承 Python中一个类可以继承多个父类,并且获得全部父类的属性和方法. class A: def demo(self): print("demo") class B: def ...