compile python modules
problem incurred by python-rpy
Now python packages on debian(Ubuntu) uses a pycentral strategy. All source files(for different versions of python) are stored in one place and .pyc/.pyo are generated for different versions of python. So source files are separated from .pyc/.pyo.
What happened to python-rpy was that .pyc/.pyo were not updated as its sources files were updated(packaging failure). The updated R has a different output format with R --version. The previous .pyc/.pyo can't parse it. So I need to manually compile them and replace those stale .pyc/.pyo.
- Three ways
- py_compilefiles:
- a program. To get .pyo, use python -O /usr/bin/py_compilefiles filename
- pycentral:
- also a program, supposedly, pycentral bccompile pkgname should work. But it did nothing even with 'sudo'.
- python modules:
- compiler, py_compile, ... One drawback is that you can't specify the new location of .pyc/.pyo. They always stay in the same directory as the source files.
- note
- python -O program could turn all modules(.pyc) invoked by program to be .pyo.