I am new to programming and have been following some tutorials for learning the basics of Python 2.7.9 syntax. I am also using Ubuntu 14.04.2 LTS.
The tutorial is discussing how to create, save, import, and test custom modules for Python in Windows OS. I have been successful at doing so in Ubuntu, but only after adding a temporary directory path in shell for PYTHONPATH
to search.
The default sys.path
directories are:
['', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages']`
As you can see, the default paths all fall under the /usr
directory.
2 solutions come to mind to fix this problem:
- How can I save under the
/usr
path directory? - How can I permanently add a new path directory?
However, attempting to save the file testmod.py
under /usr
prompts the I/O Error message:
[Errno 13] Permission denied: 'usr/local/lib/Python-2.7.9/testmod.py'