I am working on Windows 10 with Python 3.9.7
and have anaconda setup on my laptop.
I have compiled a C++ code calcSim.cpp
where the module name is calJaccSimm
and am able to successfully generate a .pyd file with the following extension .cp39-win_amd64.pyd as described here .
I am launching my jupyter notebook at the following location: jupyter-notebook D:\projects\sem4\code and my .pyd
file named calcSim.cp39-win_amd64.pyd is at the same location.
When trying to import module using:
import calJaccSimm
I am getting ModuleNotFoundError
.
I have tried the following things:
import sys
sys.path.insert(0, 'D:\projects\sem4\code')
import os
os.dll_directory("D:\projects\sem4\code")
Setup environment variables with the path '"D:\projects\sem4\code"'
Tried putting the generated
.pyd
in different locations like anaconda\DLLs and anaconda\lib\site-packages folder.
But after all this, I am still not able to load the module. Please help.
Edit 1: I had multiple versions of python on my machine. I deleted all the versions and re-installed anaconda as well. Still facing the same issue.