Pyinstaller & pycrypto

We recently added pycrypto to the project we were working on, and now I can not start the software after creating it using pyinstaller.

I am having problems with new packages in pyinstaller, but I cannot fix this in particular.

The errors I received while trying to run the firmware are as follows (sorry to rephrase, it takes quite a long time to build)

At first it was something like:

No package Crypto.Cipher

So, I added 'Crypto'in hiddenimports.spec in my file. Then I got

No module named Cipher

So, I changed 'Crypto'to 'Crypto.Cipher', and then got

Crypto.Cipher has no attribute AES

So, I changed 'Crypto.Cipher'to 'Crypto.Cipher.AES', after which I got

File "C:\Folder\made\by\pyinstaller\Crypto.Cipher.AES", line 49 in <module>
ImportError: cannot import name blockalgo

So, I changed 'Crypto.Cipher.AES'to 'Crypto.Cipher.AES.blockalgo', and the error did not change.

, script -

ERROR: Hidden import 'blockalgo' not found.

- , , pycrypto pyinstaller?

+5
5

pyinstaller:

, , Python. , " ", warnproject.txt "no module named..." , .

(, ) . :

  • hook-module.py( Python, hook-xml.dom.py) -. .

  • .spec hooks hookspath , . :

    a = (['myscript.py'], hookspath = '/my/priv/hooks') hook :

    hiddenimports = ['module1', 'module2'] , , module1 module2.

, .

, , , . , , , pyinstaller 2.1, , .

+3

? ? hiddenimport : 'Crypto', 'Crypto.Cipher', 'Crypto.Cipher.AES', 'Crypto.Random',

+1

fooobar.com/questions/14444015/...: pycryptodomex pycryptodome. @galgalesh OP , Pycrypto .

pip uninstall -y pycrypto
pip uninstall -y pycryptodome
pip install pycryptodomex

pycryptodomex pycryptodomex Crypto. , .py Crypto Cryptodome:

from Cryptodome.PublicKey import RSA

pyinstaller , . .. dist Crpytodome .pyd.

+1

:

fooobar.com/questions/14444015/...: pycryptodomex pycryptodome. @galgalesh OP , Pycrypto .

pip uninstall -y pycrypto pip uninstall -y pycryptodome pip install pycryptodomex

Pycryptodomex Cryptodome, Crypto. , .py Crypto Cryptodome:

Cryptodome. PublicKey RSA

pyinstaller , . .. dist Crpytodome, .pyd.

!

Pycryptodomex Pycrypto, !

, - Python 3.6 Pycrypto ! 2.7.16!

+1

New pycrypto libraries do not work with pyinstaller due to lack of support. You can download the old version of pycrypto, which would work perfectly with compilation under UPX or Pyinstaller, here .

-1
source

Source: https://habr.com/ru/post/1537601/


All Articles