I have written a simple program in Visual Studio C++ using PyRun_SimpleString, where I am importing the library sympy. The following is the code I have written in C++.
#include "Python.h"
#include<iostream>
#include<Windows.h>
#include<stdlib.h>
using namespace std;
int main()
{
Py_Initialize();
PySys_SetPath(L"C:/Users/acer/source/repos/merger/merger");
PyRun_SimpleString("import sys\n"
"sys.path.insert(0, 'C:/Users/acer/source/repos/merger/merger/site-packages')\n"
"import sympy\n"
"print('Hello World')");
Py_Finalize();
return 0;
}
I used sys.path.insert() to tell the program the location of the library sympy. But when the program runs init in sumpy, it shows error as it cannot find the module future, which is imported in the first line of init. The following is the error being shown -
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "C:/Users/acer/source/repos/merger/merger/site-packages\sympy\__init__.py", line 15, in <module>
from __future__ import absolute_import, print_function
ModuleNotFoundError: No module named '__future__'
What is the reason for this error? I have already copied the libraries into my project folder. I don't know how to get rid of this problem. Any help would be greatly appreciated.