Python and pizza.py

Pizza.py is a post-processing tool package for lammps – a MD package. I downloaded it and unpacked in a local directory. Each time I have to start it with a command like “python -f abs_path/pizza.py” where the abs_path is the absolute path to pizza.py source directory. However this directory is very long on my computer and it’s not a directory recognized by python. I found a convenient way to make the call easier. Just add the abs_path to a system environment variable named “PYTHONPATH” (if you have no such env variable, create it), then to use pizza.py we can start python as usual by typing “python” and then type in “import pizza” (no .py suffix!), then we have all the module defined in pizza at the interactive command line no matter what is your current working directory. PYTHONPATH will be add to the search path for modules if it’s not empty. I also add the abs_path to the PATH system environment variable, which makes I could type “pizza.py -f ***.py” directly in any working directory.
Use PYTHONPATH environment variable to install a python
module without the need of root privilege. For example,
set
PYTHONPATH=/path/to/my/lib/python2.2/site-packages/
and when installing a third party Python module, use
python setup.py install --prefix=/path/to/my
Rapid Environment Editor is a convenient tool to modify the environment variables on Windows. And it’s for free! go here to get it.
I want to quote your post in my blog. It can?
And you et an account on Twitter?
Yeah, you are welcome to re-post my articles. Please refer to my blog if you do so! Thanks!
Hello Ting
I am a graduate student, I am interested in the post-processing tool package ,I wish to learn more thing about it,I has a question, the post-processing tool packing just use under the linux platform ?if it does not,I want to know how to use under the window XP platform . Thank you !
Hi, Guanfeng Liu,
What I mentioned in this post should work on Windows. In fact I just did the job on Windows XP. And there is really no much difference to use Pizza on Windows or Linux. I suggest you start from the examples in the Pizza package. Should you have more specific problem, you are welcome to discuss here.