add a python module with out root permission
I meet a problem when I try to install module omniORB&omniORBpy to a system, I don'开发者_如何学Pythont have the root permission so I use --prefix to installed them to my user dir.
my question is : how can I make python load this module? I try add my user path to sys.path, but it still doesn't work.
Br, J.K.
You can add it to the search path by adding the directory to the environment variable PYTHONPATH
or by adding it to sys.path
in your Python script. Both work; if they don't, then you're using the wrong path.
I usually use the --user
option instead of --prefix
, since it installs it in ${HOME}/.local/lib/pythonx/site-packages
and thus it does not require to add the path to sys.path.
I think this option is available only for python 2.6 + but I am not sure.
If you have to install it in an other place, then you have no choice and I don't know what could be wrong.
By the way, maybe posting some sample code(just to see where exactly are the files and how you try to import them) would make clearer the "error".
精彩评论