Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 尝试安装程序包时发生导入错误_Python_Import_Cython - Fatal编程技术网

Python 尝试安装程序包时发生导入错误

Python 尝试安装程序包时发生导入错误,python,import,cython,Python,Import,Cython,当我尝试为python安装软件包时,setup.py包含以下行: import os, sys, platform from distutils.core import setup, Extension import subprocess from numpy import get_include from Cython.Distutils import build_ext from Cython.Build import cythonize from Cython.Compiler.Optio

当我尝试为python安装软件包时,setup.py包含以下行:

import os, sys, platform
from distutils.core import setup, Extension
import subprocess
from numpy import get_include
from Cython.Distutils import build_ext
from Cython.Build import cythonize
from Cython.Compiler.Options import get_directive_defaults
我试图在终端中运行
python setup.py install
,但收到以下错误:

回溯(最近一次呼叫最后一次):
文件“setup.py”,第9行,在
从Cython.Compiler.Options导入get\u指令\u默认值
ImportError:无法导入名称“get\u指令\u默认值”
如果您能让我知道如何修复此问题,我将不胜感激。

尝试以下方法:

import Cython as cy

def gdd():
    return cy.Compiler.Options.get_directive_defaults()
试试这个:

import Cython as cy

def gdd():
    return cy.Compiler.Options.get_directive_defaults()

setup.py文件正在使用一些相当新的功能(Cython 0.25)。更新Cython,你会没事的


如果您对如何更新Cython有疑问,请询问。

setup.py文件正在使用一些相当新的功能(Cython 0.25)。更新Cython,你会没事的


如果您对如何更新Cython有疑问,请立即询问。

根据您问题中的信息,似乎没有安装
Cython
的某个子包。也许它是可选的,您需要重新安装它并附带该部件。另一种可能性是,它不是您试图安装的任何软件包所需要的正确版本。检查它的要求,它们应该列在某个地方。根据您问题中的信息,它似乎没有安装
Cython
的某个子包。也许它是可选的,您需要重新安装它并附带该部件。另一种可能性是,它不是您试图安装的任何软件包所需要的正确版本。检查它的要求,它们应该列在某个地方。