I'm using the pycrypto
module to encrypt files. When running the python code, it works well:
$ python encrypt_file.py file
but when I build encrypt_file.py
to a binary:
$ pyinstaller -F zip_disk.py
and run the binary under dist
$ ./encrypt_file file
it shows the following error:
File "<string>", line 24, in <module>
File "/usr/local/lib/python2.7/dist-packages/PyInstaller-2.1-py2.7.egg/PyInstaller/loader/pyi_importers.py", line 270, in load_module
exec(bytecode, module.__dict__)
File "/home/xxxx/zip_disk/build/zip_disk/out00-PYZ.pyz/Crypto.Cipher.AES", line 50, in <module>
ImportError: cannot import name _AES
Why does this happen?
How to fix ImportError
?
- My import statement is
from Crypto.Cipher import AES
- Python version: Python 2.7.6
- PyCrypto version is 2.6.1. I have tried to install
pycrypto
from source and viapip
, both result in the the sameImportError
. - Platform: Linux Ubuntu 3.13.0-32-generic x86_64 x86_64 GNU/Linux