今日排错---开发者平台加签pthon报错修复

2021-07-19 开发者平台加签pthon报错修复

一.异常现象

apkSingRelease]# python ./apkNLS.py -i zhouxj.apk -o zhouxj-endsore.apk
Traceback (most recent call last):
  File "./apkNLS.py", line 12, in <module>
    from Crypto.Hash import SHA256
ImportError: No module named Crypto.Hash

二.修复步骤

1.修复ImportError: No module named Crypto.Hash报错

import模块时没有找到Crypto模块, 所以pip安装导入
Crypto模块在pip库中名称为pyCrypto

apkSingRelease]# pip install pyCrypto
-bash: /usr/bin/pip: /usr/local/bin/python: bad interpreter: No such file or directory

2.修复python: bad interpreter: No such file or directory报错

pip报错python的路径不对, 所以修改pip指定的python路径

# 尝试安装丢失的Crypto包
apkSingRelease]# pip install pyCrypto
-bash: /usr/bin/pip: /usr/local/bin/python: bad interpreter: No such file or directory

apkSingRelease]# vi /usr/bin/pip
# 修改python路径到真实python路径 #!/usr/local/bin/python -> #!/usr/bin/python

3.修复ImportError: No module named pkg_resourcespip报错

报错没有pkg_resources包, 所以安装python对应的包

apkSingRelease]# pip install pyCrypto
Traceback (most recent call last):
  File "/usr/bin/pip", line 6, in <module>
    from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

apkSingRelease]# yum install gcc python-setuptools python-devel

4.修复pkg_resources.DistributionNotFound: pip==9.0.1pip报错

apkSingRelease]# pip install pyCrypto
Traceback (most recent call last):
  File "/usr/bin/pip", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 3007, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 728, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 626, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==9.0.1

# 下载Distribution并安装
~]# wget https://files.pythonhosted.org/packages/5f/ad/1fde06877a8d7d5c9b60eff7de2d452f639916ae1d48f0b8f97bf97e570a/distribute-0.7.3.zip
~]# cd distribute-0.7.3 && python setup.py install
...
Finished processing dependencies for distribute==0.7.3

# 重新安装pip
distribute-0.7.3]# easy_install pip==9.0.1
...
Finished processing dependencies for pip==9.0.1

# 继续安装丢失的Crypto包, 终于成功
distribute-0.7.3]# pip install pyCrypto
Installing collected packages: pyCrypto
  Running setup.py install for pyCrypto ... done
Successfully installed pyCrypto-2.6.1

三.验证

apkSingRelease]# python ./apkNLS.py -i zhouxj_noSign.apk -o zhouxj-endsore.apk
start process. input:zhouxj_noSign.apk output:zhouxj-endsore.apk
sha256:0.139378070831
writeSINGINFO:0.0103378295898
writeZip:0.0118269920349
success
posted @ 2021-07-19 17:59  骁珺在努力  阅读(314)  评论(0编辑  收藏  举报