Python portable, linux & windows

user2676813 picture user2676813 · Oct 4, 2013 · Viewed 12.5k times · Source

I am using linux at home but at school we use windows 7. I want to have python installed on my usb to that I can use it for both windows and linux (ubuntu 13.04). Is there a way that I can install python on my usb so that both win and linux computers can use it? I am more interest in python 2.7. I have Wine installed on my linux machine. It might no be ideal but could I use portable python and run it under wine?

Answer

Viktor Kerkez picture Viktor Kerkez · Oct 4, 2013

You can install two python's. Download Anaconda from http://continuum.io/ website for linux and windows. Install them (on win and lin machines) and then create two environments on your USB using the conda package manager:

# Windows
conda create -p E:\pywin python all other packages you want
# Linux
conda create -p /mnt/usb/pylin python all other packages you want

Then use the pywin environment on windows and pylin on linux.

# Windows
D:\pywin\python.exe your_script.py
# Linux
/mnt/usb/pylin/bin/python your_script.py

With conda you will be able to maintain the same packages in both environments so you'll have everything you need on both systems...

Or you can install the Anaconda directly to the USB, but that will require more space...