Skip to content Skip to sidebar Skip to footer

I Get Importerror: No Module Named Pathlib, Even After Installing Pathlib With Pip

This is my first time asking on this site, so sorry if my question is not layed out correctly y@DESKTOP-MQJ3NCT:~/Real-Time-Voice-Cloning$ python demo_toolbox.py Traceback (most re

Solution 1:

When it comes to python, it's quite easy to make the mistake of just running "python ...". When you install python on windows "python" defaults to the python 2.7 installation ( probably changed now that 2.7 is no longer supported) if it is installed.

Ubuntu has the links "python2" and "python3" which makes so much more sense but can still lead to confusion.

If you have a local python Virtual environment, the "python" command defaults to the global install on windows (to further confuse people).

I find it generally best to create my own links to the global python "python27" and "python36" to avoid these confusions.

Same goes for pip. It's best to call

python3 -m pip install ... 

Also. PyCharm is the most amazing Python IDE in the world and it helps with so much.

Solution 2:

Sorry, turns out it was a simple mistake!

Instead of:

python demo_toolbox.py

I should have used

python3 demo_toolbox.py

As Linux defaults to Python 2 or something incompatible with pathlib

Post a Comment for "I Get Importerror: No Module Named Pathlib, Even After Installing Pathlib With Pip"