Question

I am new to Python (as of today) and having trouble following this example for AES: https://pypi.python.org/pypi/pycrypto/2.6.1 using Python 3.3

from Crypto.Cipher import AES

I downloaded the package from here https://www.dlitz.net/software/pycrypto/ (pycrypto-2.6.1.tar.gz) as I want it as a local dependency since this is a portable plugin for Sublime Text 3.

So I have /MyPLugin/Crypto/ and Crypto looks good having the expected __init__.py files in the right places.

In /MyPlugin/myplugin.py I am trying to import AES like in the example (from Crypto.Cipher import AES). I have tried many combinations with dots and stuff but nothing seems to work.

How can I import AES from this relative Crypto folder?

Couple of the tries:

from MyPlugin.Crypto.Cipher import AES = ImportError: cannot import name AES

import Crypto = ImportError: No module named 'Crypto'

import .Crypto = SyntaxError: invalid syntax

PS I made a mistake - it is using Python 3.3

Était-ce utile?

La solution

Make sure that the library you are talking about is in your python path. Information about modifying your python path here. I'd try doing that. Although, when you add a new library this usually happens.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top