小编Iva*_*kin的帖子

使用 tar.gz 的 pip 安装没有名为“Cython”的模块

我使用 Poetry 为我的示例包(https://github.com/iamishalkin/cyrtd)构建 tar.gz 和 whl 文件,然后尝试在 pipenv 环境中安装包。tar.gz 安装失败,这是一段日志:

$ poetry build
...
$ pip install dist/cyrtd-0.1.0.tar.gz
Processing c:\work2\cyrtd\dist\cyrtd-0.1.0.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: cython<0.30.0,>=0.29.13 in c:\users\ivan.mishalkin\.virtualenvs\cyrtd-tpdvsw8x\lib\site-packages (from cyrtd==0.1.0) (0.29.15)
Building wheels for collected packages: cyrtd
  Building wheel for cyrtd (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
...
from Cython.Build import cythonize
  ModuleNotFoundError: No module named 'Cython' …
Run Code Online (Sandbox Code Playgroud)

python cython pipenv python-poetry

12
推荐指数
1
解决办法
1122
查看次数

删除类方法python生成的所有变量(类)

由于某种原因,我需要能够删除从某种方法中派生的所有子级(在某种意义上)。这是一个例子:

class A():
    def __init__(self):
        self.a_val = 56
        self.children = list()

    def __del__(self):
        del self.children

    def gen_b(self):
        return B(self.a_val)

class B():
    def __init__(self, val):
        self.a_val = val
        self.b_val = 87
Run Code Online (Sandbox Code Playgroud)

我想要的是以某种方式将生成的类B从追加gen_b到A().children:

a_class = A()
b_generated = a_class.gen_b()
del a_class
# b_generated is also deleted
Run Code Online (Sandbox Code Playgroud)

另外,对于cython,我需要使用它(我使用cdef类),因此,也许有些解决方案__dealloc__或其他Cython特定的符号。所有解决方案将不胜感激。

python cython

5
推荐指数
1
解决办法
72
查看次数

设置 setuptools 以创建带有可用标头的 cimportable 包

我尝试实现答案/sf/answers/4023641961/,但我坚持从另一个包导入一个包。

代码在这里:https : //github.com/iamishalkin/setuptools_cython_question

我想要的是wrap从包装器文件夹中获得一个独立的包,这样您就可以在没有cust包的情况下使用它。

而且我还希望能够通过FuncWrapper从wrap.

我所做的:

  • 首先,我python setup.py bdist_wheel在wrapper文件夹中运行(我想这是我做错的地方,因为它只给了我二进制文件)
  • 下一个 pip instal dist/(some_name).whl
  • 接下来,我添加import wrap和include_dirs=wrap.get_include()对custom/setup.py喜欢它的完成numpy
  • 我python setup.py bdist_wheel在custom文件夹中运行,但失败了,第一步没有创建除二进制文件之外的文件

所以问题是:如何将.pxd文件添加到最终包中。

我也试过sdist哪个不编译cython代码而只是复制它。

python setuptools cython cimport

4
推荐指数
1
解决办法
178
查看次数

标签 统计

cython ×3

python ×3

cimport ×1

pipenv ×1

python-poetry ×1

setuptools ×1