I compiled and installed pycrypto 2.6 on Mac OSX Lion with Python 3.2 but when I try to run command
import Crypto.Cipher.AES
I get this problem
Traceback (most recent call last):
File "/Users/DaZzz/Documents/Python Workspace/Cryptography Coursera/W2PA.py", line 8, in <module>
import Crypto.Cipher.AES
File "/Library/Python/2.7/site-packages/Crypto/Cipher/AES.py", line 50, in <module>
from Crypto.Cipher import _AES
ImportError: dlopen(/Library/Python/2.7/site-packages/Crypto/Cipher/_AES.so, 2): Symbol not found: _PyInt_FromLong
Referenced from: /Library/Python/2.7/site-packages/Crypto/Cipher/_AES.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/Crypto/Cipher/_AES.so
By the way, I use eclipse with installed PyDev. I also tried to run it in IDLE but I got following error:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import Crypto.Cipher.AES
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/Crypto/Cipher/AES.py", line 50, in <module>
from Crypto.Cipher import _AES
ImportError: cannot import name _AES
It should be emphasized that to run it in IDLE I copied directory with Crypto into the python path.
What am I doing wrong?
See the /Library/Python/2.7
in the messages? It appears you are actually running Python 2.7 here. You need to tell PyDev to use Python 3.2. And are you sure you used the Python 3.2 version of IDLE? There are separate IDLE's for each version of Python. Try typing idle3.2
from the command line or, in the Finder, click on /Applications/Python 3.2/IDLE.app
.
Update: Works for me using the python.org 64-/32-bit Python 3.2.3 and Xcode 4.3 (you may need to create a symlink for /Developer
to work around the change of SDK locations for Xcode 4.3).
# for Xcode 4.3+ only
$ [ ! -e /Developer ] && sudo ln -s Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer /Developer
$ tar xf ./pycrypto-2.6.tar.gz
$ cd ./pycrypto-2.6
$ python3.2 setup.py install
$ cd
$ python3.2
Python 3.2.3 (v3.2.3:3d0686d90f55, Apr 10 2012, 11:25:50)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Crypto.Cipher.AES
>>> Crypto.Cipher.AES.__file__
'/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/Crypto/Cipher/AES.py'