我正在try 在python3.9.6和MacOS Sonoma 14.3.1下安装pyregion(一个与天文数据分析有关的包).

我try 过各种方法,但总是遇到新的障碍. 在标准方法之后: pip3 install pyregion 它失败并出现错误消息 "Failed building wheel for pyregion". 在try 了在stackoverflow上找到的许多其他建议之后,包括升级numpy,升级pip3本身, python3 -m pip install pyregion

我现在try 直接安装这些文件,这些文件可以在以下位置找到: https://pypi.org/project/pyregion/#files

run 的第一个障碍 python3 setup.py install个 是:

Traceback (most recent call last):
  File "/Users/claudiopedrazzi/Downloads/pyregion-2.2.0/setup.py", line 5, in <module>
    from Cython.Build import cythonize
ModuleNotFoundError: No module named 'Cython'*

然后我还安装了Cython pip3 install --upgrade cython

它成功地为我安装了cython—3.0.9. 再次try 运行www.example.com,我得到一个很长的错误消息,结尾是:

/Users/claudiopedrazzi/Library/Python/3.9/lib/python/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it with " \
 ^
pyregion/_region_filter.c:18264:3: error: incompatible pointer to integer conversion returning 'void *' from a function with result type 'int' [-Wint-conversion]
  import_array();
  ^~~~~~~~~~~~~~
/Users/claudiopedrazzi/Library/Python/3.9/lib/python/site-packages/numpy/core/include/numpy/__multiarray_api.h:1558:151: note: expanded from macro 'import_array'
#define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NULL; } }
                                                                                                                                                      ^~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include/stddef.h:89:16: note: expanded from macro 'NULL'
#  define NULL ((void*)0)
               ^~~~~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/clang' failed with exit code 1

我真的需要一步一步的指导.我的环境是最新的,我不明白为什么这个特殊的包会出现这些问题,而其他的包,如astropy和matplotlib工作得很好.

推荐答案

您可能应该向维护人员提出修复该问题的请求.我能够很容易地重现这个问题.看起来他们在跟上环境方面落在了后面.

I am going to assume the code was written correctly, which may not be the case. The maintainers need to address this. You may have issues if there is indeed a bug.考虑到这一点,我能够通过在安装时添加-Wno-int-conversion编译器标志来克服"错误:指向整数转换的不兼容指针",这告诉编译器这个转换实际上是正确的.

CFLAGS="-Wno-int-conversion" pip install pyregion

为了完整起见,我使用虚拟环境完成了这项工作.我并不认为这有什么关系.

Python相关问答推荐

Python会扔掉未使用的表情吗?

如何在具有重复数据的pandas中对groupby进行总和,同时保留其他列

抓取rotowire MLB球员新闻并使用Python形成表格

未删除映射表的行

"使用odbc_connect(raw)连接字符串登录失败;可用于pyodbc"

如何在Python数据框架中加速序列的符号化

如何使用pytest来查看Python中是否存在class attribution属性?

在Python中动态计算范围

处理具有多个独立头的CSV文件

在pandas/python中计数嵌套类别

如何检测鼠标/键盘的空闲时间,而不是其他输入设备?

在电影中向西北方向对齐""

如何从比较函数生成ngroup?

当HTTP 201响应包含 Big Data 的POST请求时,应该是什么?  

如何为需要初始化的具体类实现依赖反转和接口分离?

利用SCIPY沿第一轴对数组进行内插

在round函数中使用列值

设置索引值每隔17行左右更改的索引

某些值的数值幂和**之间的差异

是否将列表分割为2?