在casa中安装astropy

Installation of astropy in casa

我正在尝试将 astropy 安装到我的 Mac 上的 CASA 4.3.1 中。我正在按照找到的说明进行操作 here。但是在 运行 pip.main(['install', 'astropy', '--user']) 之后,我得到:

AttributeError: 'module' object has no attribute 'main'

有没有其他人遇到过这个问题?

编辑:

使用后

import pip._internal
pip._internal.main(['install', 'astropy', '--user'])

安装开始但因错误而停止:

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/

我找到了答案并分享它以防其他人将来遇到同样的问题。步骤如下。按照我在问题中提到的程序进行操作后,没有最后一步,需要 运行 在终端中执行以下命令:

python -m pip install --upgrade pip setuptools wheel

然后打开 casa 和 import pip._internal 最后 运行 pip._internal.main(['install', 'astropy', '--user']).