Thursday, January 20, 2011

Install Python Package on ECN-computer

Install Python Package on Windows System (e.g.ECN-computer) that do not have the authority.

Since we do not have the authority to write into the path, such as: C:\Python25, we can not install the package in the typical path: C:\Python25\Lib\site-packages


We finally find how to install the Lib by ourselves:

For windows-ECN:

a- run cmd
b- In the promoted shell: N:>   {this is the window's shell starting note}
N:>C:\Python25\python.exe "C:\TEMP\PythonLib\MDP-3.0\setup.py" install --prefix=C:\TEMP\PythonLib

Notes:
C:\Python25\python.exe   ==> System Python path
"C:\TEMP\PythonLib\MDP-3.0\setup.py"   ==> path of which of the setup.py is going to run
--prefix=C:\TEMP\PythonLib   ===> this is where we are going to install the lib
                by this, a file <C:\TEMP\PythonLib\Lib\site-packages> will be installed
                when using it, in the Python Shell:
                >>>sys.path.append('C:\TEMP\PythonLib\Lib\site-packages')

This idea is coming from:
http://wiki.pylonshq.com/display/pylonscookbook/Using+a+Virtualenv+Sandbox

Also, note that we encouter the error messagy saying that it can not find the file: "mdp\__init__.py"
we then check the code, and made the following adjust ment in the setup.py

    # mdp_init = open(os.path.join(os.getcwd(), 'mdp', '__init__.py'))
    mdp_init = open(os.path.join("C:/TEMP/PythonLib/MDP-3.0/", 'mdp', '__init__.py'))

This is simple since we know exactly where our file is .
 

No comments:

Post a Comment