Search code examples
pythonpipeasy-installsetup.pypysvg

How to install a Python module without root, pip, setuptools, or easy_install


I'm trying to install the pySVG module onto a web hosting system, but I do not have root access, and none of these tools are installed: pip, setuptools, or easy_install.

The package consists of just a bunch of .py files, so I'm hoping there is some manual way to "install" the module without having to run an installer. On my local machine, I can do "python setup.py build", and all it does is copies the .py files into the 'build' directory:

$ ls -l build/lib/pysvg/
total 480
-rw-r--r--  1 timur  staff    278 Nov  5  2012 __init__.py
-rw-r--r--  1 timur  staff   8489 Nov  6  2012 animate.py
-rw-r--r--  1 timur  staff  29395 Nov  5  2012 attributes.py
-rw-r--r--  1 timur  staff  47916 Oct 31 16:14 attributes.pyc
-rw-r--r--  1 timur  staff  14633 Nov  6  2012 builders.py
-rw-r--r--  1 timur  staff   9081 Nov  6  2012 core.py
-rw-r--r--  1 timur  staff  11006 Oct 31 16:14 core.pyc
-rw-r--r--  1 timur  staff  22269 Nov  6  2012 filter.py
-rw-r--r--  1 timur  staff   6072 Nov  6  2012 gradient.py
-rw-r--r--  1 timur  staff   2171 Nov  6  2012 linking.py
-rw-r--r--  1 timur  staff   2630 Nov  6  2012 parser.py
-rw-r--r--  1 timur  staff    628 Nov  6  2012 script.py
-rw-r--r--  1 timur  staff  17266 Nov  6  2012 shape.py
-rw-r--r--  1 timur  staff   8217 Nov  6  2012 structure.py
-rw-r--r--  1 timur  staff    932 Nov  6  2012 style.py
-rw-r--r--  1 timur  staff   1626 Oct 31 16:14 style.pyc
-rw-r--r--  1 timur  staff   6990 Nov  6  2012 text.py
-rw-r--r--  1 timur  staff   7781 Nov  6  2012 turtle.py
-rw-r--r--  1 timur  staff     55 Nov  5  2012 util.py

Can I just copy these files to the web server, and then somehow modify my Python script to "load" the module? Normally I would do this:

import pysvg.builders
import pysvg.structure
import pysvg.style
import pysvg.shape
from pysvg.turtle import Turtle, Vector

I'm hoping there's a way to modify these lines to manually load the .py files and treat them as modules.


Solution

  • Add build/lib/ to PYTHONPATH.