|
|
Subscribe / Log in / New account

Python discusses deprecations

Python discusses deprecations

Posted Dec 9, 2021 0:23 UTC (Thu) by Cyberax (✭ supporter ✭, #52523)
In reply to: Python discusses deprecations by gtb
Parent article: Python discusses deprecations

> How do you feel about building yourself an ancient version of Python, installing it as `python2` (or `python1` even), and running the ancient Python code under it?

And then struggle with module paths, because Python modules in /usr will not be compatible with older Python. Or your PYTHONPATH env variable might interfere.

Running ancient Debian in a VM/container is actually a pretty good way to get a working environment.


to post comments

Python discusses deprecations

Posted Dec 9, 2021 2:55 UTC (Thu) by NYKevin (subscriber, #129325) [Link]

The standard, widely-supported solution to that problem (virtualenv/venv) has been part of the standard library since 3.3, and was originally developed outside the stdlib (so you can use it with Python 2 as well). See https://docs.python.org/3/library/venv.html for details.

In short: It magicks up a shell environment in which PYTHONPATH etc. all point to an isolated set of directories which have nothing to do with the system Python. Then you can install whatever you want into that environment, and not have to worry about conflicts with anybody else. It is *not* a full-blown container or VM, or anything nearly as heavy as spinning up a complete instance of Debian.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds