Installing python3 modules

Terry Reedy tjreedy at udel.edu
Sat Dec 26 13:51:02 EST 2020


On 12/26/2020 12:13 PM, Rich Shepard wrote:
> Running Slackware-14.2/x86_64 here. I'm trying to learn if any installed
> applications are still dependent on Python2 (version 2.7.17 installed) as
> its EOL is this coming Thursday and I want to clean out all Python2 modules
> and replace them with their Python3 versions (3.9 installed here). This
> raises several questions.
> 
> First, I had to remove, reinstall, and upgrade pip. The pip web page says
> it's compatible with python2 and 3 through 3.8. Does this mean it still 
> does
> not support Python3.9?
> 
> Second, pip installed itself in /usr/lib64/python2/site-packages/, not the
> python3.9/site-packages/ directory.

Pip is a python code run by a python interpreter.  It installs itself in 
the site-packages of the python you use to run it.  'pythonx -m 
ensurepip' will make sure some pip is available for pythonx.  'pythonx 
-m pip' will then run the pythonx pip and manipulate the contents of its 
site-packages.

> There's not a pip3

Separate 'pip' executables can be ambiguous as to which python they will 
invoke.  Some people consider them a mistake.

> so how do I get pip
> and all other python modules in the python3.9/site-packages/ directory?

See above.  Run pip with python3.9, however that is spelled on a 
particular system.  I don't know if all the modules you want have 
versions compatible with 3.9, but anything actively maintained should. 
The 3.8 versions of pure python modules will often run with 3.9 without 
change, even if not yet certified to do so by the authors.

-- 
Terry Jan Reedy



More information about the Python-list mailing list