Yocto-ModuleNotFoundError: No module named 'Crypto'

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Yocto-ModuleNotFoundError: No module named 'Crypto'

5,190件の閲覧回数
sd05
Contributor III

Hello Community

I am getting one issue  in yocto

I am trying to execute a python script from inside

IMAGE_CMD_tar_append (){

python3 myscript.py

}

getting following errors

from Crypto.PublicKey import RSA
| ModuleNotFoundError: No module named 'Crypto'

 

but if I try same command from command line it works

Please guide!

Thanks

0 件の賞賛
返信
2 返答(返信)

5,177件の閲覧回数
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello sd05,

For python3 the package name is now pycryptodome or pycryptodomex

If you need compatibility with your project with Python2 use pycryptodome or else use pycryptodomex which is a library independent of the old PyCrypto.

Regards

0 件の賞賛
返信

4,204件の閲覧回数
gilbertcane
Contributor I

To make it short, it means that you lacked some "dependencies" for the libraries you wanted to use. This is a common problem when installing python packages, mainly in windows. Before trying to use any kind of library, first it is suggested to look up whether it needs another library in python "family".

The solution is to provide the python interpreter with the path-to-your-module/library. The simplest solution is to append that python path to your sys.path list. In your notebook, first try:

import sys
sys.path.append('my/path/to/module/folder')

This isn't a permanent change in sys.path, because when you log out, your environment is reset, so any variables you may have set are lost.

The better (and more permanent) way to solve this is to set your PYTHONPATH, which provides the interpreter with additional directories look in for python packages/modules.

from BASH type: export PYTHONPATH=/path/to/new/folder:/another/path/...../

#each path must be separated by a colon

 

0 件の賞賛
返信