Friday, December 26, 2014

Where to put libraries in python ?  Follow any of the following approach.

1. Current working directory

2. Set 'PYTHONLIB' environment variable at command line shell

3. In your script, do
    import sys
  sys.path.append(<directory location>)

4. Put in Python specific default lib locations. 
    e.g. /usr/lib/python3.3 

5. Create <anyname>.pth file with list of directory abs paths separated by new line. Where each path contains location of library files.
   import site
   site.addsitedir('/some/dir/you/want/on/the/path')
  

No comments:

Post a Comment