Installation hell
Peter J. Holzer
hjp-python at hjp.at
Mon Dec 19 11:54:51 EST 2022
On 2022-12-19 10:55:52 -0500, Thomas Passin wrote:
> On 12/19/2022 9:59 AM, Weatherby,Gerard wrote:
> > Personally, I don’t use Windows and avoid it like the plague.
> > Python is easy to install on Linux and Mac.
>
> That's not been my experience. Windows installers for Python have worked
> well for me over many generations of Python releases.
I haven't had any problem either despite being only an occasional
Windows user.
It is however, quite noticable that almost everyone who asks a question
about their Python installation on this list is using Windows. I don't
think this is just because there are more Windows users than Linux or
Mac Users.
> It's Linux where I've found difficulties. For example, if your
> distro's Python install didn't include tkinter (or even pip), how do
> you get it? It's different for different Linux distros.
Yes, but most Linux users don't use a dozen different distributions. And
if you've used one for a while you generaLLy know their general naming
conventions. So just guessing (with a little help from your shell's
expansion mechanism) the name will take you a long way.
So as a long-time Debian and Ubuntu user I just know that a Python
package foo will be packaged as python3-foo while a Perl package of the
same name would be packaged as libfoo-perl. Not exactly consistent, but
you get used to it. On RedHat (which I've also used for a long time) the
naming conventions are a bit different but also easy to find out.
> For another example, when you use pip to install a package, it sometimes
> suggests that you install a newer version of pip itself. Should you do that?
> On Linux, probably not, because the distro will have modified pip so it puts
> things in distro-specific places. Yet there is no newer version of pip
> available through the distro's package manager. Will anything bad happen if
> you don't update pip? Who knows?
If I use pip on Linux I almost always install into a virtual environment
(rule 1: Don't mess with the package manager). So year, I can install a
new version of pip into that virtual environment without affecting
anything else.
> I have a Linux VM that has several versions of Python3 on it. Python3.8
> came installed with the distro, but for some programs I need Python 3.9+.
> If I forget which versions I have, how can I find out?
I type python and then ctrl-D. The shell will then show me all commands
starting with "python" in my path (your shell may have a different key
combination for that, maybe tab-tab).
> People say to use which, but that doesn't work - it only reports
> "python3".
More specifically it will report *where* the exact command you named is
installed. So "which python3" might report /usr/bin/python3 or
/usr/local/bin/python3 or maybe /opt/python3.9.2/bin/python3 but it will
never report the presence of any executable not named "python3" and even
if you have several it will only give you one of them.
> ~$ find 2>/dev/null ~ -name python -type d |grep "site"
> /home/tom/.local/lib/python3.9/site-packages/PyQt5/Qt5/qsci/api/python
> /home/tom/.local/lib/python3.8/site-packages/pandas/_libs/src/ujson/python
> /home/tom/.local/lib/python3.10/site-packages/PyQt5/Qt5/qsci/api/python
>
> Not that this task is much easier to remember on Windows, but it's not
> harder. One way: the "py" launcher will tell you:
>
> py --list
> -V:3.10 * Python 3.10 (64-bit)
> -V:3.9 Python 3.9 (64-bit)
> -V:3.7 Python 3.7 (64-bit)
> -V:2.7
But that works only for Python. Shell expansion works for any command.
If you use Linux, learn how to use your shell (and maybe learn different
shells - I personally prefer zsh, but I can also use bash, ksh, tcsh and
if necessary even sh).
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp at hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mail.python.org/pipermail/python-list/attachments/20221219/8e346db5/attachment.sig>
More information about the Python-list
mailing list