Running two python versions in 12.04
Marius Gedminas
marius at pov.lt
Wed Mar 12 15:05:56 UTC 2014
On Wed, Mar 12, 2014 at 08:39:29AM -0500, Jim Byrnes wrote:
> On 03/12/2014 12:03 AM, Erick Ocrospoma wrote:
> >Virtualenv[1] will help you in this case.
> >
> >
> >[1] www.virtualenv.org/
>
> I've read about virtualenv and always came away a little confused.
> I think it is over kill for my needs, but if I am wrong I will have
> to spend more time to understand it.
If, as you say, the standard library is enough for you, ignore
virtualenv for now. But once you discover you need something more,
virtualenv is *the* answer.
Very short intro of the way I use it:
$ sudo apt-get install python-virtualenv
Then for every project
$ cd /path/to/my/project
$ virtualenv . # if Python 2.x
or
$ virtualenv -p python3 # if Python 3.x
then
$ ls bin lib local include >> .gitignore # you keep your projects in a VCS, right?
$ bin/pip install requests Pillow # and many other fine libraries
$ bin/python myscript.py
(And to automate the library install for next time,
$ bin/pip freeze > requirements.txt
$ git add requirements.txt
so on next checkout you can do
$ virtualenv .
$ bin/pip install -r requirements.txt
$ bin/python myscript.py
)
Marius Gedminas
--
Life begins when you can spend your spare time programming instead of
watching television.
-- Cal Keegan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20140312/b65589c7/attachment.sig>
More information about the ubuntu-users
mailing list