Using system python vs. updated/current version

M

memilanuk

Hello there,

What would be considered the correct/best way to run a current release
of python locally vs. the installed system version? On openSUSE 12.3,
the repos currently have 2.7.3 and 3.3.0. As far as I know, I'm not
really hitting any limitations with the existing versions - my skills
just aren't that far along - so its not a burning 'need' but I'm still
curious/interested in the topic.

Also... in some places in the 'Net I see references to installing
everything 'locally' via pip, etc. in virtualenvs and not touching the
system installed version of python... yet most linux distros seem to
have many/most such packages available in their package repos, which
seems like it'd be easier to install via the package manager and let it
keep things updated. Could someone touch on what they feel the pros and
cons would be either way?

Thanks,

Monte
 
A

alex23

Also... in some places in the 'Net I see references to installing
everything 'locally' via pip, etc. in virtualenvs and not touching the
system installed version of python... yet most linux distros seem to
have many/most such packages available in their package repos, which
seems like it'd be easier to install via the package manager and let it
keep things updated. Could someone touch on what they feel the pros and
cons would be either way?

Generally, if your OS installs a version of Python by default you should
leave it alone because the OS itself is dependent on it. Updating to
newer versions of Python or installed libraries can introduce version
conflict errors in system-level apps, which is a bad thing.

Similarly, using the system install & libraries ties you to those
versions. This may not be an issue if you're just scripting a few helper
tools for your system, but it's an unnecessary hinderance if you're
developing independent applications.

Tools like virtualenv or zc.buildout provide a handy way of sandboxing
the dependencies of individual applications. They let you build more
than one app in parallel and not let the dependencies of one interfere
with the others. Of equal importance is their use in deploying to other
machines. With virtualenv, you can create a list of installed libraries
with:

pip freeze > requirements.txt

To ensure a target machine has all of the dependencies your application
needs you can then do:

pin install -r requirements.txt

So: for simple scripts, just go with the system install. For serious
development work, I highly recommend using virtualenv or zc.buildout to
contain each development environment.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top