I had Python versions of 2.7 and 3.5. I wanted the install a newer version of Python which is python 3.8. I am using Ubuntu 16.04 and I can not just uninstall Python 3.5 due to the dependencies. So in order to run my scripts, I use python3.8 app.py
. No problem so far. But when I want to install new packages via pip:
python3.8 -m pip install pylint
It throws an error:
AttributeError: module 'platform' has no attribute 'linux_distribution'
So far, I tried:
sudo update-alternatives --config python3
and chose python3.8 and run command by starting with python3 but no luck.
Then:
sudo ln -sf /usr/bin/python3.5 /usr/bin/python3
I also tried running the command by starting with python3 but it did not work either.
How can I fix it so that I can install new packages to my new version of Python?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…