Forums

Where are packages installed to?

I can't seem to find a Python directory, or where packages/modules are installed to.

The quickest way to find out where something is installed is to use Python's __file__ attribute -- eg.

>>> import django
>>> django.__file__
'/usr/local/lib/python2.7/dist-packages/django/__init__.py'

Thanks.

I did this, and get the same thing you do: '/usr/local/lib/python2.7/dist-packages/django/init.py'

But where is '/usr/'? I don't see a directory named 'usr', not is there a '/local/' directory under my '/home/username/' directory.

In my case, local packages are at:

/home/jgmdavies/.local/lib/python3.3/site-packages

@bjornagain: we hide some of the system folders on the root page of the file browser, but they are all actually there. you can view them in a Bash console, or if you manually build a URL for it, eg:

https://www.pythonanywhere.com/user/bjornagain/files/usr/local/lib/python2.7/dist-packages/django/

They're also visible in the FTP client I normally use (Ipswitch WS_FTP Pro).

Jim

I see. Thanks!

I came across this when i wanted to edit my flask uploads module, so i thought i would give a 2021 answer:

if you created a virtualenv like the doc suggest then there are in your virtualenv in my case:

/home/myUsername/.virtualenvs/myVirtualEnv/lib/python3.6/site-packages/

Glad to see that you found it.