I installed Python 3.4.1 on my Mac (OSX 10.9.4), and I need to work with enums. I started to write a script in a text file:
#!/usr/bin/python from enum import Enum
And from the terminal:
chmod 0700 myscript.py ./myscript.py
But I get the following error:
from enum import Enum ImportError: No module named enum
At the same time, if I use IDLE I have no problem with the command:
from enum import Enum
How can I use enum from a script file?
echo $PYTHONPATH nothing is printed. While following is the output of
['/Users/Marco/Desktop/scripts', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages']
I can see that the first path corresponds to the directory where
myscript.py is located, also it seems that it is used the 2.7 version of python, even if I just installed the last version (3.4.1).