Skip to content

Environment variables are not synchronized #2538

Description

@gitlsl

Environment

  • Pythonnet version:3.0.5
  • Python version:3.12
  • Operating System:win11
  • .NET Runtime:.net8

Details

  • Describe what you were trying to get done.

I tested the virtual environment created with Poetry and it always failed. The test found that there were issues with the environment variables

Environment.SetEnvironmentVariable("AA","BB");

Runtime.PythonDLL = @"D:\Program Files\Python312\python312.dll";
PythonEngine.Initialize();

PythonEngine.RunSimpleString("""

                             import os
                             
                             for e in os.environ:
                                 print(e,':', os.environ[e])
                             """);

no AA in os.environ, so Environment variables in https://github.com/pythonnet/pythonnet/wiki/Using-Python.NET-with-Virtual-Environments no effect, So it leads to the inability to call Python in virtual environments?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions