ubuntu20/04编译android11源码问题:ImportError: No module named Crypto.Signature

编译问题:ImportError: No module named Crypto.Signature
错误原因:未安装python相关处理工具

解决方案:安装python pycrypto库

1、更新源列表
sudo apt update
2、安装pip2,无法使用Ubuntu20.04源仓库进行安装,需要使用get-pip.py脚本来为python2 安装 pip2.

// 下面这个链接可能会失效,不过会提示你去新的链接下载,把链接换了就可以。
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
sudo python2 get-pip.py
pip --version

1.检查python版本是不是2.7
2.sudo apt install python2-dev  //安装相关依赖
3.sudo pip2 install pycrypto

问题记录:

xxx $ curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 2574k  100 2574k    0     0   8749      0  0:05:01  0:05:01 --:--:-- 16009
xxx $ sudo python2 get-pip.py
ERROR: This script does not work on Python 2.7 The minimum supported Python version is 3.7. Please use https://bootstrap.pypa.io/pip/2.7/get-pip.py instead.
xxx k$ pip

Command 'pip' not found, but can be installed with:

sudo apt install python3-pip

xxx $ pip --version

Command 'pip' not found, but can be installed with:

sudo apt install python3-pip

xxx $ sudo apt install python-pip
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
有一些软件包无法被安装。如果您用的是 unstable 发行版,这也许是
因为系统无法达到您要求的状态造成的。该版本中可能会有一些您需要的软件
包尚未被创建或是它们已被从新到(Incoming)目录移出。
下列信息可能会对解决问题有所帮助:

下列软件包有未满足的依赖关系:
 python-pip : 依赖: python-colorama 但是它将不会被安装
              依赖: python-distlib 但是它将不会被安装
              依赖: python-requests 但是它将不会被安装
              推荐: python-dev-all (>= 2.6) 但无法安装它
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。
xxx $ curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1863k  100 1863k    0     0   5495      0  0:05:47  0:05:47 --:--:--  6523
xxx $ 
xxx $ sudo python2 get-pip.py
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting pip<21.0
  Downloading pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 10 kB/s 
Collecting setuptools<45
  Downloading setuptools-44.1.1-py2.py3-none-any.whl (583 kB)
     |████████████████████████████████| 583 kB 7.9 kB/s 
Collecting wheel
  Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-20.3.4 setuptools-44.1.1 wheel-0.37.1

3、查看pip版本:pip --version

xxx $ sudo pip2 install pycrypto
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting pycrypto
  Using cached pycrypto-2.6.1.tar.gz (446 kB)
Building wheels for collected packages: pycrypto
  Building wheel for pycrypto (setup.py) ... done
  Created wheel for pycrypto: filename=pycrypto-2.6.1-cp27-cp27mu-linux_x86_64.whl size=497804 sha256=5212e471e560c77e4d3504fc3ed16dce8ecd2d31c57e768a1e7f645cd1b5b106
  Stored in directory: /root/.cache/pip/wheels/b6/e6/c8/d1eca13628952ceec1d40d96e0a7a1380460d2349ce0b85312
Successfully built pycrypto
Installing collected packages: pycrypto
Successfully installed pycrypto-2.6.1
Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐