[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Python version hell
From: |
John Ackermann N8UR |
Subject: |
Python version hell |
Date: |
Tue, 28 Apr 2020 10:01:46 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 |
I'm running Ubuntu 19.10 which installs Python 2.7 as the system
default. I tend to use Python 3.7 for my projects, using a shebang line
of "#!/usr/bin/env python3".
When I first tried to build using scons on the cloned repo, it
complained because it couldn't find the pyserial module, which makes
sense because I installed that for python3.
After RTFM, I ran "scons target_python=python3.7" and that completed
without errors.
HOWEVER, the python programs like gpsrinex and gpsprof still use a
shebang line of "#!/usr/bin/env python" which executes the default
python2.7.
That of course fails, because the gps module is built for Python3 per
the target_python argument.
I don't know how the scons system works, but suggest that if a
target_python is specified, that version should be used in the shebang
line for the generated programs.
An additional related but minor point:
scons created /usr/local/lib/python3 and put the gps module there.
However, /usr/local/lib/python3.7 was already in existence and as noted
I had specified the python_target to be python3.7.
It seems a tad aggressive for scons to create a new version directory in
lib/ and particularly to do so with the major number when it's been
given both major and minor in target_python.
I think that on some Linux distros lib/python<major> is a symlink to
lib/python<major.minor>. That doesn't seem to be the case on Ubuntu, at
least in /usr/local/lib.
Finally, guess what: in the newly released Ubuntu 20.04, the default is
now Python3! :-)
Thanks,
John
- Python version hell,
John Ackermann N8UR <=