问题
My dictionary looks like this:
pycra
|_____crack.py
|_____files.py
|_____parse.py
|_____pycra_cy.c
|_____pycra_cy.cpython-36m-x86_64-linux-gnu.so
|_____pycra_cy.pyx
|_____setup.py
|_____tools.py
My main module crack.py
starts with this:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import parse
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import distance, cKDTree
import pandas as pd
import time
import tools
import files
import os
import pathlib
import pycra_cy
...
...
class Crack:
def _init__(self, ...):
...
pycra_cy._calc_length(self)
But when i'm trying to run it, i get the following error message:
SystemError: Parent module 'pycra_cy' not loaded, cannot perform relative import
My file 'setup.py' currently looks like this:
from distutils.core import setup
from Cython.Build import cythonize
import numpy
setup(ext_modules = cythonize('pycra_cy.pyx'), include_dirs=[numpy.get_include()])
Don't know how to fix this error.
来源:https://stackoverflow.com/questions/64892902/systemerror-parent-module-pycra-cy-not-loaded-cannot-perform-relative-import