OESF Portables Forum
Everything Else => Zaurus - Everything Development => Distros, Development, and Model Specific Forums => Archived Forums => Python => Topic started by: Optogeek on February 16, 2005, 12:13:01 pm
-
This is probably obvious but I thought I should mention it.
If you are using kopsis' excellent read-only, compressed python image you can still add modules to the system even thought the site-packages directory is read-only.
Create a directory on you internal drive (I call mine /home/zaurus/python_mod) and then add to your .profile file the line
export PYTHONPATH=/home/zaurus/python_mod
You can now add modules to this directory as much as you want/have space for.
WARNING!!! This adds PYTHONPATH to the start of python's search path so if you add modules with the same name as in the image the new ones will be called first. This may or may not be a good thing
-
I know it is bad form to reply to your own posts but I have modifed this process slightly so that distutils can install new modules. This works with the READ ONLY image for modules that are pure python. If you what to install a module with bits of C in them you will need one of the dev images install but it should work.
Fist you need to add a couple of directories in your home directory if you don't already have them.
mkdir ~/bin
mkdir ~/lib
mkdir ~/lib/python
mkdir ~/share
Now add a line in your .profile file
PYTHONPATH=$HOME/lib/python
export PYTHONPATH
and optionally alter the PATH line
PATH={what ever is here}:$HOME/bin
Lastly create a file in your home directory called .pydistutils.cfg containing
[install]
home=$HOME
For good luck restart.
Now if you try to install something packaged with distutils you can use something like
python setup.py install
and the modules will be placed in the the ~/lib/python directory which is now sourced in your python code. In theory you can install newer/older versions of the modules in the read-only image and the freshly installed versions will override the built in versions (I have not tried this).
If anyone tries this let me know. I have installed a couple of packages with distutils and it seems to work ok as does writing modules and saving them into ~/lib/python
-
Great instructions! I need to remember to put a link to this post in the docs on my Sourceforge page
-
No problem.
I am still slowly learning how to use Python (upto Chapter 6 in Dive into Python) but I know my way around a *nix file system