I'm working on a python code. This code uses a library that is written in cython. when I run, I face this error:
I use python3.7. I've searched a lot but I couldn't find a useful way to solve it. I think that visual cpp has not been matched with python. First I had visual cpp 2017 but didn't work and I uninstalled it. After that I installed only visualcppbuildtools but the result didn't change. Can anyone help me? (Also I added the below part to my code but the result didn't change.)
This is setup.py :
from distutils.core import setup
from Cython.Build import cythonize
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
ext_modules=[
Extension("lib2",
["lib2.pyx"],
language="c++",
libraries=["m"],
extra_compile_args = ["-std=c++11", "-O3", "-ffast-math", "-
march=native", "-fopenmp" ],
extra_link_args=['-fopenmp'],
include_dirs=[numpy.get_include()]
)
]
setup(
name = "lib2",
cmdclass = {"build_ext": build_ext},
ext_modules = ext_modules,
include_dirs=[numpy.get_include()]
)
this the main.py:
import sys
sys.path.append('E:\EDU\Hipp\septo-hippocampal-model-master\septo-
hippocampal-model-master\cython_code')
import pyximport
pyximport.install()
import lib2 as lib
and the last one is lib2.pyx:
from libc.math cimport exp, cos
from libcpp.map cimport map
from libcpp.pair cimport pair
from libcpp.string cimport string
from libcpp.vector cimport vector
from libcpp cimport bool
from cython.operator cimport dereference, preincrement
import numpy as np
cimport numpy as np
from libcpp.queue cimport queue
from cython.parallel cimport parallel, prange
cimport cython
By those simple codes I still receive the above error.