every time we want to import modulewe can put it in the file bashrcto ensure that it is run automatically when we open new terminal window the bashrc file should be in your home directory ( '/users/sundnesbashrc')and will be listed with ls - (the dot at the start of the filename makes it hidden fileso it will not show up with just ls if the file is not thereyou can simply create it in an editor and save it in your home directoryand the system should find it and read it automatically the next time you open terminal window as an alternative to editing the systemwide environment variablewe can also add our directory to the path from inside the program putting line such as this inside your codebefore you import the moduleshould allow python to find itsys path insert( '/users/sundnes/lib/python/mymods'as an alternative to creating your own directory for modulesand then tell python where to find themyou can place the modules in one of the places where python always looks for modules the location of these varies bit between different python installationsbut the directory itself is usually named site-packages if you have installed numpy or another package that is not part of the standard python distributionyou can locate the correct directory by importing this package for instancetype the following in an interactive python shellimport numpy numpy __file__ '/users/sundnes/anaconda /lib/python /site-packages/numpy/__init__ pythe last line reveals the location of the site-packages directoryand placing your own modules there will ensure python will find them numpy is package for numerical calculations it is not part of the standard python distributionbut it is often installed automatically if you install python from other sourcesfor instancefrom anaconda otherwiseit can be installed for instancewith pip or other tools the numpy package will be used extensively in the next