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?
Asked
Active
Viewed 1.4k times
8
-
1Well, you can test whether Portable Python runs under Wine, but it probably does. Is that all you were asking? – abarnert Oct 03 '13 at 23:15
-
1is there a reason for doing that? – Foo Bar User Oct 03 '13 at 23:25
-
The schools computer do not have python and I can't install it. – Oct 03 '13 at 23:49
2 Answers
7
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...

Viktor Kerkez
- 45,070
- 12
- 104
- 85
-
I can't can't install python any of the school computers. Like I said will only be able to run python from the usb. Does this still work in my scenario? – Oct 03 '13 at 23:41
-
1@Gecko: You will need to borrow a Windows machine from somewhere—or set up a Windows virtual machine on your linux box—in order to create the Windows environment for your USB drive. After that, it will work on machines that don't have Python installed on it. – abarnert Oct 03 '13 at 23:51
-
@Gecko You can also install anaconda directly to usb. But it will take more space... – Viktor Kerkez Oct 04 '13 at 15:30
-
Yes, you can run it like this for simple scripts, but as of 2021, in windows every package is being pushed in user profile like this - PLOTLY_DIR = os.environ.get( "PLOTLY_DIR", os.path.join(os.path.expanduser("~"), ".plotly") – WebComer Apr 25 '21 at 09:30
-
see discussion here - https://stackoverflow.com/questions/39984611/can-anaconda-be-packaged-for-a-portable-zero-configuration-install#:~:text=TO%20make%20Anaconda3%20truly%20portable,user-data%20in%20a%20dedicated – WebComer Apr 25 '21 at 09:30
0
You could always try a browser based solution with the files hosted in .txt files on Google Drive or Dropbox. Skulpt.com syncs with GitHub too, so you can work that way.

iamwpj
- 180
- 7