1) How to install Python / Pip on Windows 7 (or 8)

How to install Python / Pip on Windows 7 (or 8)

  1. Download the MSI installer from http://www.python.org/download/. Select 32 bit or 64 bit based on the System Settings which opens by pressing Win+Break
  2. Run the installer. Be sure to check the option to add Python to your PATH while installing.
  3. Open PowerShell as admin by right clicking on the PowerShell icon and selecting ‘Run as Admin’
  4. To solve permission issues, run the following command:
    Set-ExecutionPolicy Unrestricted
    
  5. Enter the following commands in PowerShell to download the bootstrap scripts for easy_install and pip:
    mkdir c:\envs
    cd c:\envs
    
    (new-object System.Net.WebClient).DownloadFile('https://bootstrap.pypa.io/ez_setup.py',   'c:\envs\distribute_setup.py')
    
    (new-object System.Net.WebClient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'c:\envs\get-pip.py')
    
    python c:\envs\distribute_setup.py
    python c:\envs\get-pip.py
    
    
    Once these commands run successfully, you can delete the scripts get-pip.py and distribute_setup.py
    HTTP Issue with distribute_setup.py?
    [Updated 2015-03-05] The script distribute_setup is no longer available at its old location. Thanks to Rudhra for sharing the new location.
  6. Now typing easy_install or pip should work. If it doesn’t it means the Scripts folder is not in your path. Run the next command in that case (Note that this command must be run only once or your PATH will get longer and longer). Make sure to replace c:\Python33\Scripts with the correct location of your Python installation:
    setx PATH "%PATH%;C:\Python33\Scripts"
    
    Close and reopen PowerShell after running this command.
  7. To create a Virtual Environment, use the following commands:
    cd c:\python
    pip install virtualenv
    virtualenv acme
    .\acme\Scripts\activate.ps1
    pip install IPython
    ipython3
    
    That’s it! I suppose the same steps work for Windows 8 as well. But I don’t have a machine to try it out. Do let me know if this worked for you.

Now set PATH as below

setx PATH "%PATH%;C:\Python33\Scripts"


Comments

Popular posts from this blog