Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Is there a good way to determine at runtime which python versions are supported?#1724

Mikhinja started this conversation inGeneral
Discussion options

Often we have multiple versions of python installed, although not idea. For example, most often I find python 3.7 or 3.8 in parallel with 3.9.

When I'm using pythonnet 2.5.1 I would like to flag in my UI somehow that 3.9 is not supported, so I can react, like change some paths or switch the version to 3.7 or 3.8.
I would like to make a check, get all installed python versions, and a list of the supported ones by python.NET, to exclude the unsupported ones in my app.

Is there a good way to determine this at runtime?

You must be logged in to vote

Replies: 1 comment 4 replies

Comment options

Tryhttps://github.com/losttech/WhichPython
This can list the installed Python versions.

You must be logged in to vote
4 replies
@Mikhinja
Comment options

Thanks Victor!
Is there anything that can list, at runtime, the supported versions by python.NET?

My use case is that my app is an add-in and doesn't install python.NET itself, so I can't just hardcode a value.

One very hacky way I can think of is to try and findPython.Runtime.dll (relying on a relative path), and listing the generated namespacesTypeOffsetXY where X is the major version and Y is the minor version, for exampleTypeOffset37. But this is sort of a hacky way and very prone to errors.

Is there a good way of finding out what are the supported versions by python.NET, at runtime?

@filmor
Comment options

We could expose this as a property or function in the DLL (only for 3.0 onwards, I don't think we will make another 2.5 release).

@Mikhinja
Comment options

Ok, good to know. And yes, I believe that would be a good thing to have going forward.
Thank you, Benedikt!

@cdfarrow
Comment options

We could expose this as a property or function in the DLL (only for 3.0 onwards, I don't think we will make another 2.5 release).

That would be helpful. I've just put a hard-wired check for Python <= 3.8 into my library to avoid mysterious exceptions when it runs with Python 3.10.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
General
Labels
None yet
4 participants
@Mikhinja@filmor@lostmsu@cdfarrow

[8]ページ先頭

©2009-2025 Movatter.jp