March 19, 2017

Windows Install and use Python without admin rights

Sometimes it is useful to install Python in a preferred directory other than to a default Windows partition directory. The main reasons for doing this are given below:
  1. Have multiple Python versions and run them as per requirements (use Python versions 2.7 and 3 simultaneously on the same system)
  2. Have Python Interpreter on a portable disk (Python on the go)
  3. Tryout experimental and latest Python versions and Python packages/libraries (leave the default system Python Interpreter unaltered)
Installing Python without admin rights:

Step 1: Download Python installer(msi file) from official website https://www.python.org/


Step 2: Open up Windows Command Prompt where msi file is downloaded and execute the following command,

msiexec /a python-2.7.10.msi /qb TARGETDIR=G:\Python27

Here, TARGETDIR specifies the target folder where Python will be installed.

Once setup is finished you should be able to find python.exe (Python Interpreter) and IDLE (Python Integrated Development Environment) in the G:\python27 and G:\Python27\Lib\idlelib folders respectively.

Step 3: Install pip Python utility script for installing Python packages/libraries by downloading get-pip.py file and executing the following command from the G:\Python27 folder,

python.exe get-pip.py

Step 4: Install Python packages/libraries using pip by executing the following commands from G:\Python,

python.exe -m pip install numpy

Here, numpy is Python package/library name which will be download and installed to Python Interpreter directory by the pip utility. If a package/library is not available in the standard Python pip repository then you can download pip install-able (whl files) Python packages/libraries from pythonlibs and install them by executing following command from G:\Python27, assuming whl files are placed in the same folder,

python.exe -m pip install numpy‑1.11.3+mkl‑cp27‑cp27m‑win32.whl

Cheers!

No comments:

Post a Comment