Installing Packages



  • I'm looking for a way to install site packages for a new DrawBot.
    (I was trying to install for example PageBot or Letterror's coverage)

    When I was following the tutorial from PageBot's github (https://github.com/PageBot/PageBot/blob/master/INSTALL.md) It didn't work at all.

    this code:

    import site
    
    print('Found site at %s' % site.__file__)
    packages = site.getsitepackages()
    for p in packages:
        print(' - %s' % p)
    

    throws error:

    Found site at /Applications/DrawBot.app/Contents/Resources/site.pyc
    Traceback (most recent call last):
      File "<untitled>", line 4, in <module>
    AttributeError: module 'site' has no attribute 'getsitepackages'
    

    even If I'm trying to change the name of the site.pyc (I'm tring to follow the PageBot tutorial)


    import sys
    print(sys.path)
    

    prints out

    ['/Users/--USER--NAME--',
    '/Applications/DrawBot.app/Contents/Resources/lib/python36.zip',
    '/Applications/DrawBot.app/Contents/Resources/lib/python3.6',
    '/Applications/DrawBot.app/Contents/Resources/lib/python3.6/lib-dynload',
    '/Applications/DrawBot.app/Contents/Resources/lib/python3.6/site-packages.zip',
    '/Applications/DrawBot.app/Contents/Resources/lib/python3.6/site-packages']
    

    so it doesn't care about my python3 site-package folder (/usr/local/lib/python3.6/site-packages/)



  • @rafalbuchner did you try to append the directory to the sys.path?

    sys.path.append('/usr/local/lib/python3.6/site-packages/')
    


  • @jo Yes, right now I'm working like that,
    but I would try to avoid this solution in particular,
    since I consider it as not Pythonic and "proper"


Log in to reply