Skip to content

Commit

Permalink
Merge branch 'main' into issue-6267
Browse files Browse the repository at this point in the history
  • Loading branch information
matteius committed Oct 22, 2024
2 parents a8aa9b3 + 792ac5c commit acbf199
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 159 deletions.
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

0 comments on commit acbf199

Please sign in to comment.