- Virtualisation of a own Python environment with the website hoster
- Installation of the required tools with easy_install.
For your information:
- I didn't know numpy, scipy and friends could be (easily) installed with easy_install
- This at least requires the gcc tools or the corresponding compiling and building tools to be installed with the server
You can indeed install third party packages to your hosted space. If it's a pure python package, all that's needed is to unpack it to a directory and then add that directory to your PYTHONPATH environment variable or
sys.path
.This can be tiring to do often, and won't work easily for compiled modules. If you have shell access to your python host, the excellent virtualenv package allows you to do set up a private python environment with its own libraries.
To set up your virtualenv, you'll do something like this at the shell:
$ virtualenv $HOME/my_python
$ $HOME/my_python/bin/easy_install numpy
You can keep running easy_install for anything else you want to install in your personal python environment.
Now, when you write your python scripts, you will want to use your private python interpreter, if that is possible:
#!/home/myuser/my_python/bin/python
import numpy
# script here
If your python env cannot be specified (such as if run by mod_wsgi), you will need to add it to the import path:
import sys
sys.path.insert(0, '/home/myuser/my_python/lib/python2.5/site-packages')
import numpy
No comments:
Post a Comment
Note: only a member of this blog may post a comment.