最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - How can i explicitly specify my runtime in pythonnet (.Net4.8 Framework SDK)? And how can i see the runtime that has py

programmeradmin4浏览0评论

I would like to specify the .Net version explicitly. My requirement is: .Net Framework SDK 4.8

How can I find out which runtime is being used?

And how can I specify it explicitly?

Running this code

pythonnet.load()
pythonnet.get_runtime_info()

generated this output:

  Version:      <undefined>
  Initialized:  True
  Shut down:    False
  Properties:
    domain = 
    config_file = None

Why is the Version undefined.

My Requirements are .Net Framework SDK 4.8

When i load this runtimeconfig.json

{
    "runtimeOptions": {
      "tfm": "net4.8",
      "frameworks": [       
        {
          "name": "Microsoft.NETCore.App",
          "version": "4.8"
        }
      ]
    }
  }
import logging
import os

import pythonnet

ROOT = os.path.abspath(os.path.dirname(__file__))
logger = logging.getLogger(__name__)

def initialize():
    pythonnet.load(
        "netfx",
        config_file=os.path.join(ROOT, "runtimeconfig.json"),
    )
    logger.info("------------>: %s", pythonnet.get_runtime_info())

Output

15:14:56,919 - dotnet:15 - INFO - ------------>: Runtime: .NET Framework
=============
  Version:      <undefined>
  Initialized:  True
  Shut down:    False
  Properties:
    domain = 
    config_file = D:\xxx\yyy\src\sinplcproject\runtimeco…

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论