如何使pycharm重新确认系统安装的cython模块?
我在ubuntu 20.04上。我已经为python3安装了lxml。我有一个如何使pycharm重新确认系统安装的cython模块?,pycharm,cython,Pycharm,Cython,我在ubuntu 20.04上。我已经为python3安装了lxml。我有一个test.pyxcimport lxml: cimport lxml.includes.etreepublic as cetree cdef object etree from lxml import etree cetree.import_lxml__etree() cimport中不存在lxml的pycharm报告。但是setup.py可以毫无问题地构建它。有谁能告诉我,我还需要什么额外的步骤来确保pychar
test.pyx
cimport lxml:
cimport lxml.includes.etreepublic as cetree
cdef object etree
from lxml import etree
cetree.import_lxml__etree()
cimport中不存在lxml的pycharm报告。但是setup.py可以毫无问题地构建它。有谁能告诉我,我还需要什么额外的步骤来确保pycharm识别cython模块?我想让自动完成工作 setup.py:
import subprocess
from setuptools import setup
from Cython.Distutils import build_ext
from Cython.Distutils.extension import Extension
from Cython.Build import cythonize
import lxml
def pkgconfig(package: str, **kwargs):
flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}
output = subprocess.getoutput(
'pkg-config --cflags --libs {}'.format(package))
for token in output.strip().split():
kwargs.setdefault(flag_map.get(token[:2]), []).append(token[2:])
return kwargs
ext_modules = cythonize(
Extension(
"test",
sources=["test.pyx"],
language="c",
**pkgconfig(
"libxml-2.0",
include_dirs=lxml.__path__,
),
),
language_level = "3"
)
“我想让自动完成工作”