Attributeerror: module platform has no attribute linux_distribution

Are you encountering the error attributeerror: module platform has no attribute linux_distribution when you try to install new packages with Python 3.8? Don’t worry, as in this article, we will show you the solution to this error.

We truly understand how frustrating it is to encounter such errors. That is why we are here to assist you in solving this one. But before that, have a brief understanding of what Python is.

What is Python?

Python is one of the most popular programming languages. It is used for developing a wide range of applications. It is a high-level programming language that is usually used by developers nowadays due to its flexibility.

Returning to our issue, we must take a few actions to fix this error. So, without further ado, let’s move on to our “how to fix this error” tutorial.

How to solve “module platform has no attribute linux_distribution” in Python

To resolve the error message stating “attributeerror: module platform has no attribute linux_distribution” when you try to install new packages with Python 3.8, use the following commands:

sudo apt remove python3-pip
sudo python3.8 -m easy_install pip

Commands you might need

  • pip list

    This command will display all the packages installed on your system, including their versions.

    Use the !pip list command instead of pip list if you use Jupyter Notebook. However, if you’re using Anaconda, use the command conda list.
  • pip install --upgrade pip

    Use this command to upgrade the pip package manager to its newest version. If your pip is already in the latest version, this will come out: “Requirement already satisfied.”
  • pip --version

    Use this command to check what version of pip you have or have installed on your system.

    Note: If you’re using Jupyter notebook, use the command !pip --version.
  • python --version

    Use this command to check what version of Python you have.

    Note: If you’re using Jupyter notebook, use the command !python --version. However, if you’re using Anaconda, just use the command python --version.
  • pip show (package)

    Use this command to display information about a module or package, including its location and version. For example, pip show asyncio.

    Note: If you’re using Jupyter Notebook, use the command !pip show asyncio.

Conclusion

In conclusion, the error attributeerror: module platform has no attribute linux_distribution can be easily solved by implementing the commands sudo apt remove python3-pip and sudo python3.8 -m easy_install pip.

By following the guide above, there’s no doubt that you’ll be able to resolve this error quickly.

We hope you’ve learned a lot from this. If you have any questions or suggestions, please leave a comment below, and for more Python tutorials, visit our website.

Thank you for reading!

Leave a Comment