ImportError: No module named clr when using CPython python.org

I am writing C ++ code that should call Python scripts below. For this, I am using cpython from python.org . Some of the python scripts execute .net code with python for .net, and when it comes to .net, all of this fails. I tried to create a test application to check where it did not work, and found that it could not import the clr module.

When I run this code, it gives me ImportError: There is no module named clr

Py_Initialize();
PyRun_SimpleString("import clr");

If I go into the Python console and type "import clr", everything works fine. I also checked sys.path and it contains the folder where clr.pyd is located in "C: \ Python27 \ DLLs". I also tried setting this path in C ++:

char* path = "C:\\Python27\\dlls";
Py_Initialize();
PySys_SetArgv(1, &path);
char* phome = Py_GetPythonHome();

. , , clr clr.pyd, .pyc, .

- , clr CPython? ?

+5
3

clr, pythonnet.

pythonnet, .

 pip install pythonnet
+7

PySys_SetArgv Py_Initialize syspath.

+1

- python. bat, , , . , bat . IP- "9.254.0.1:81"

SET path="C:\Programs\Python\Python3_64"
pip install --proxy="9.254.0.1:81" --upgrade pip
pip install --proxy="9.254.0.1:81" pythonnet
0

All Articles