Why is Pathlib module not found in my venv?

Question:

I tried

>>> import Pathlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'Pathlib'

I checked from shell

pip install Pathlib
Requirement already satisfied: Pathlib in /Users/milenko/mario/venv/lib/python3.8/site-packages (1.0.1)

How it comes that I can not import this module?

Asked By: Djikii

||

Answers:

Python considers Pathlib and pathlib differently.try: pip install pathlib and import pathlib
if it doesn’t work then try
pip3 install pathlib

Answered By: pjk

pathlib is part of the standard library for Python 3.4+.

In my case, I was using the old import line

from Pathlib import Path

Solution

from pathlib import Path
Answered By: DanielBell99
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.