[lug] Running a mixed Python environment

Jed S. Baer blug at jbaer.cotse.net
Fri Sep 11 08:13:48 MDT 2020


Hi Everyone.

I just finished up an install of Ubuntu 20.4. Of course, various things are
broken. Anyways...

I have some Python scripts which still need to run under Python2. It
exists, but some pieces are missing, and aren't in the repositories. The 2
that come to mind are PyRSS2Gen and serial. I have them for Python3, but
the scripts don't see them. Of course, it's a path issue. I've read that
PyRSS2Gen works with both v2 and v3 scripts. I don't know about the Python3
serial module.

Is fixing this as simple as setting up something like ~/python2 and putting
it in PYTHONPATH, and then using pip (or setup.py) to put things there? I'm
seeing references to "--user" installing to "HOME", but the articles don't
go into any detail on that.

Once I get that figured, I assume I'll have to do some other thing to force
running in Python2, maybe change the #! to /usr/bin/env python2? Or just
/usr/bin/python2? (I guess there's no practical difference.)

If it creates any complications, 2 of the scripts run under invocation of
Liferea to create RSS feeds. Those live in /usr/local/bin, but could just
as well sit in ~/bin. Liferea is running under my username, but I'm
uncertain of the environment - these days, I don't want to assume that
anything from my bashrc or bash_profile is getting set. (No, I have no
trust left.)

-- 
All operating systems suck, but Linux just sucks less
 - Linus Torvalds


More information about the LUG mailing list