Reputation: 3578
I want to install python on a flash drive in a virtual environment so that I can develop code wherever I am. Is this possible to do in such a way that I can use my flash drive on windows/mac/linux computers?
Upvotes: 5
Views: 2745
Reputation: 2630
Be aware that this is never 100% bullet proof as you are depending on Python version you are using/bringing packages for.
Upvotes: 4
Reputation: 5804
As @millimoose pointed out, you could install three different versions of Python.
For each Python package you are working on, you can create a .pth
file in the site-packages
directory of each Python version that you would like to use the package from.
Note that, as described here:
If you put a
.pth
file in thesite-packages
directory containing a path, python searches this path for imports.
For example, if you have a package named my_package
that you are working on that resides at the path C:\Users\Me\Documents\dev_packages\my_package
, you can add a file with extension .pth
(note that the name doesn't matter, specifically it doesn't have to have any relation to the package name), with the contents:
C:\Users\Me\Documents\dev_packages
This will add C:\Users\Me\Documents\dev_packages
to the Python import search-path, causing the my_package
package to be discovered. By placing this .pth
file in the site-packages
directory of each Python version, my_package
will be available in all corresponding versions of Python.
Upvotes: 0
Reputation: 605
You could try looking at setting up something using some VirtualEnv type environments, with the various Python versions installed on your machines.
Not sure how you'd get round the different paths on the different operating systems though.
Virtualenv: http://pypi.python.org/pypi/virtualenv
Upvotes: 0