Workaround read-only site-packages for cx_freeze
Question
I'm currently trying to make cx_freeze
to work on a Solaris workstation I have to work with, in order to make an executable from a Python script I have. Problem is, I'm not administrator of this machine, and installation of cx_freeze
requests write to site-packages, which is read-only for me.
So, obviously, I get this error:
creating /usr/local/lib/python2.6/site-packages/cx_Freeze
error: could not create '/usr/local/lib/python2.6/site-packages/cx_Freeze': Read-only file system
And if I try to run it anyway, it fails:
bash-3.00$ python /home/xxxx/cx_freeze-4.2.3/cxfreeze --target-dir cx_dist src/p_tool.py
Traceback (most recent call last):
File "/home/xxxx/cx_freeze-4.2.3/cxfreeze", line 5, in <module>
main()
File "/home/xxxx/cx_freeze-4.2.3/cx_Freeze/main.py", line 187, in main
silent = options.silent)
File "/home/xxxx/cx_freeze-4.2.3/cx_Freeze/freezer.py", line 91, in __init__
self._VerifyConfiguration()
File "/home/xxxx/cx_freeze-4.2.3/cx_Freeze/freezer.py", line 371, in _VerifyConfiguration
self._GetInitScriptFileName()
File "/home/xxxx/cx_freeze-4.2.3/cx_Freeze/freezer.py", line 283, in _GetInitScriptFileName
raise ConfigError("no initscript named %s", name)
cx_Freeze.freezer.ConfigError: no initscript named Console
Obviously, this is linked to the failed installation. So, here's my question:
Without installation of virtualenv
, could I avoid the writing to site-packages
, and make cx_freeze
to execute from my home folder?
EDIT I had a look at site.py documentation, and PYTHONPATH
filling should be equivalent to use of site-packages
. So my question is now more something like: what is the path to be added to PYTHONPATH
, so that cx_freeze
could be executed from any location?
Notes:
- I would like to avoid to deal with
virtualenv
, as I'm already struggling to understand the executable tools... - I saw this question, but this still requires access to
site-packages
folder, plus it's not user-specific; - I tried adding the following path to PYTHONPATH, but this does not work:
/home/xxxx/cx_freeze-4.2.3/build/lib.solaris-2.10-sun4v-2.6
; - I'm also trying to use
PyInstaller
but have dependency problems (and the administrator is not really helping me).
La solution
This works like a charm for me :
$ python setup.py install --home=$HOME
Run in the source directory of cx_freeze found on the Sourceforge download page.