Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pipenv/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@ def safe_import(self, name: str) -> ModuleType:
def python_version(self) -> str | None:
with self.activated() as active:
if active:
sysconfig = self.safe_import("sysconfig")
py_version = sysconfig.get_python_version()
return py_version
from pipenv.patched.pip._vendor.packaging.version import Version

# Extract version parts
version_str = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
python_version = Version(version_str) # Create PEP 440 compliant version
return str(python_version) # Return the string representation
else:
return None

Expand Down
Loading