I'm trying to install multiple python versions on Windows as I need a 32-bit and 64-bit version. I currently have python 3.7 32 bit installed and am trying to get python 3.9 64-bit working (although I tried this with 3.8 64-bit as well, getting me the same results).
Installing via the executable files provided via python.org does no give any issues, expect that pip doesn't seem to be installed properly. When checking the pip install via pip3.9 -V
, I get 'pip3.9' is not recognized as an internal or external command, operable program or batch file.
even though I have set the environment variables for this new python install.
When I check the python install, it starts to make sense that it has troubles finding pip, as it isn't installed in Python39Scripts
. However, when I manually try to install pip using py -3.9 get-pip.py
, I get another error:
Traceback (most recent call last):
File "<user>get-pip.py", line 24, in <module>
import pkgutil
File "<user>AppDataLocalProgramsPythonPython37-32Libpkgutil.py", line 5, in <module>
import importlib
File "<user>AppDataLocalProgramsPythonPython37-32Libimportlib\__init__.py", line 51, in <module>
_w_long = _bootstrap_external._w_long
AttributeError: module 'importlib._bootstrap_external' has no attribute '_w_long'
This traceback indicates that, even though I'm calling py -3.9
, it is using libraries from my python 3.7 install. The same error pops up when running py -3.9 -m pip --version
or py -3.9 -m ensurepip --upgrade
.
Related stackoverflow questions (here and here) haven't been able to help as they seem to run into the same error in a different situation.
Any help would be appriciated!
question from:
https://stackoverflow.com/questions/65941132/pip-reference-broken-for-multiple-python-versions 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…