SystemError, Parent module 'pycra_cy' not loaded, cannot perform relative import

坚强是说给别人听的谎言 提交于 2020-11-25 04:25:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!