小编Dia*_*ana的帖子

来自SciPy的QHull凸壳体积

我正在尝试使用QHullSciPy包装器来获取一组点的凸包体积.

根据QHull文档,我应该通过"FA"选项来获得总表面积和体积.

这就是我得到的......我做错了什么?

> pts
     [(494.0, 95.0, 0.0), (494.0, 95.0, 1.0) ... (494.0, 100.0, 4.0), (494.0, 100.0, 5.0)]


> hull = spatial.ConvexHull(pts, qhull_options="FA")

> dir(hull)

     ['__class__', '__del__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_qhull', '_update', 'add_points', 'close', 'coplanar', 'equations', 'max_bound', 'min_bound', 'ndim', 'neighbors', 'npoints', 'nsimplex', 'points', 'simplices']

 > dir(hull._qhull)
     ['__class__', '__delattr__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__new__', …
Run Code Online (Sandbox Code Playgroud)

python scipy convex-hull qhull

12
推荐指数
2
解决办法
6624
查看次数

distutils 可以将模块/包安装为可执行脚本吗?

我第一次使用 distutils.core.setup。我让它在 /usr/lib/python/site-packages 中安装我的模块。

如果我从任何目录运行 python 并且做import my_module这一切都很好。

但是,我需要将我的模块作为脚本运行。它不是作为一个库,而是作为一个应用程序。如果我从终端运行,python my_module它找不到该文件。

我想制作一个可执行脚本来运行我的模块并在 /usr/bin 中放置一个指向它的符号链接,但这似乎是一种解决这个问题的hacky方法。我认为 distutils 可以将您的模块安装为可执行脚本,但我找不到它。有人可以为此指出一个示例或文档文件吗?

编辑:另外,如果这不是分发 python 应用程序的正确方法,我应该使用什么?

python deployment installation distutils setup.py

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