PythonNet FileNotFoundException: Unable to find assembly

前端 未结 2 1155
难免孤独
难免孤独 2020-12-30 11:25

I am trying to execute a Python script that uses Python For .Net (https://github.com/pythonnet/pythonnet) to load a C# library called \"Kratos_3.dll\" which is in the same f

2条回答
  •  没有蜡笔的小新
    2020-12-30 11:56

    It turns out that even though I added the path through

    sys.path.insert(0,"C:\\dev\\proj_1\\")
    

    it still couldn't find the file because the .dll because Windows was not enabling it to load from "external sources". To fix this:

    1. Right-click on the .dll
    2. "Properties"
    3. Under "General", click "Unblock"

提交回复
热议问题