- Notifications
You must be signed in to change notification settings - Fork752
Description
Environment
- Pythonnet version: 2.4.00
- Python version: 2.7.13
- Operating System: Windows 7
Details
- Describe what you were trying to get done.
I have usedpip install git+https://github.com/pythonnet/pythonnet
to install latest python net.
I've created a .NET visual studio 2015 project to make calls to Python. I reference the Python.Runtime.dll file in the project. When I let it get copied to the binary directory of my project calls to CPython work fine.
Now, I don't want to bundle the DLL with my application. As I understand, different versions work with different versions of CPython. I would like to load Python.Runtime.dll from Lib\site-packages so I get version appropriate for version of Python installed on the system. I change properties of the PythonRuntime.dll reference to NOT copy the DLL to bin directory. Now I get the error:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in PyRunner.exeAdditional information: Could not load file or assembly 'Python.Runtime, Version=2.4.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
This minimal program causes the error.
using Python.Runtime;namespace PyRunner{class ErrorExample{static void Main(string[] args){PythonEngine.Initialize();}}}
I've tracked down other issues related to this but none seem to simply be that the DLL is not found.
When I try to install the assembly in the GAC I get
>gacutil /i Lib\site-packages\Python.Runtime.dllMicrosoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0Copyright (c) Microsoft Corporation. All rights reserved.Failure adding assembly to the cache: Attempt to install an assembly without a strong name
Thanks