【发布时间】:2025-12-12 14:00:01
【问题描述】:
我对编程还不是很有经验。我正在尝试将此模块安装到 Canopy 上,但遇到了一些问题(POPPY,一个物理光学模拟模块)。安装说明(找到 here)告诉我进行 pip 安装,我在下面进行。错误消息说我需要 astropy 模块。我在 Canopy 上安装了 astropy,但这似乎无法识别。
我需要在别处安装 astropy 模块吗?
它是这样说的:
ME$ pip install poppy --upgrade下载/解压罂粟 下载 poppy-0.3.tar.gz (1.6MB):下载了 1.6MB 为包 poppy 运行 setup.py egg_info 回溯(最近一次通话最后): 文件“”,第 16 行,在 文件“/private/var/folders/-G/-GUFgmQKF2ysFZMLTUvftE+++TI/-Tmp-/pip_build_ME/poppy/setup.py”,第 12 行,在“模块”中 进口天文 ImportError:没有名为astropy的模块 命令 python setup.py egg_info 的完整输出: Traceback(最近一次调用最后一次):
文件“”,第 16 行,在
文件“/private/var/folders/-G/-GUFgmQKF2ysFZMLTUvftE+++TI/-Tmp-/pip_build_ME/poppy/setup.py”,第 12 行,在
import astropy
ImportError: No module named astropy
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /private/var/folders/-G/-GUFgmQKF2ysFZMLTUvftE+++TI/-Tmp-/pip_build_ME/poppy
Storing complete log in /Users/ME/.pip/pip.log
我不确定这是否相关,但我也尝试了“pip install poppy”(没有“--upgrade”)。错误有点不同,但可能是相关的。这是它给出的:
ME$ pip install poppy 下载/解压罂粟 下载 poppy-0.3.tar.gz (1.6MB):下载了 1.6MB 运行 setup.py (path:/Users/ME/Library/Enthought/Canopy_64bit/User/build/poppy/setup.py) egg_info for package poppy 警告:AstropyDeprecationWarning:astropy.setup_helpers.update_package_files 已弃用。更新您的 setup.py 以使用 astropy.setup_helpers.get_package_info 代替。 [astropy.setup_helpers]
安装收集的包:poppy 为罂粟运行 setup.py install 警告:AstropyDeprecationWarning:astropy.setup_helpers.update_package_files 已弃用。更新您的 setup.py 以使用 astropy.setup_helpers.get_package_info 代替。 [astropy.setup_helpers] 生成默认的 poppy.cfg 文件 回溯(最近一次通话最后): 文件“”,第 1 行,在 文件“/Users/ME/Library/Enthought/Canopy_64bit/User/build/poppy/setup.py”,第 144 行,在 use_2to3=假 文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/core.py”,第 152 行,在设置中 dist.run_commands() 文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/dist.py”,第 953 行,在 run_commands self.run_command(cmd) 文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/dist.py”,第 972 行,在 run_command cmd_obj.run() 运行中的文件“/Users/ME/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/setuptools/command/install.py”,第 53 行 返回 _install.run(self) 运行中的文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/command/install.py”,第 563 行 self.run_command('build') 文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/cmd.py”,第 326 行,在 run_command self.distribution.run_command(command) 文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/dist.py”,第 972 行,在 run_command cmd_obj.run() 运行中的文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/command/build.py”,第 127 行 self.run_command(cmd_name) 文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/cmd.py”,第 326 行,在 run_command self.distribution.run_command(command) 文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/dist.py”,第 972 行,在 run_command cmd_obj.run() 运行中的文件“/Users/ME/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/astropy/setup_helpers.py”,第 631 行 对于 k, (fnsrc, v) 在 Six.iteritems(self.distribution.command_options['pytest']) 中: 键错误:'pytest' 命令 /Users/ME/Library/Enthought/Canopy_64bit/User/bin/python -c "import setuptools, tokenize;file='/Users/ME/Library/Enthought/Canopy_64bit/User 的完整输出/build/poppy/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\ n'), file, 'exec'))" install --record /var/folders/-G/-GUFgmQKF2ysFZMLTUvftE+++TI/-Tmp-/pip-CyYl8x-record/install- record.txt --single-version-externally-managed --compile --install-headers /Users/ME/Library/Enthought/Canopy_64bit/User/include/site/python2.7: 警告:AstropyDeprecationWarning:astropy.setup_helpers.update_package_files 已弃用。更新您的 setup.py 以使用 astropy.setup_helpers.get_package_info 代替。 [astropy.setup_helpers]
运行安装
运行构建
运行 build_py
创建构建
创建 build/lib.macosx-10.6-x86_64-2.7
创建 build/lib.macosx-10.6-x86_64-2.7/poppy
复制 poppy/init.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
复制 poppy/conf.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
复制 poppy/cython_version.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
复制 poppy/fwcentroid.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
复制 poppy/instrument.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
复制 poppy/matrixDFT.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
复制 poppy/poppy_core.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
复制 poppy/utils.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
复制 poppy/version.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
复制 poppy/wfe.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
创建 build/lib.macosx-10.6-x86_64-2.7/poppy/tests
复制 poppy/tests/init.py -> build/lib.macosx-10.6-x86_64-2.7/poppy/tests
复制 poppy/tests/test_core.py -> build/lib.macosx-10.6-x86_64-2.7/poppy/tests
复制 poppy/tests/test_fft.py -> build/lib.macosx-10.6-x86_64-2.7/poppy/tests
复制 poppy/tests/test_nonsquare.py -> build/lib.macosx-10.6-x86_64-2.7/poppy/tests
复制 poppy/tests/test_optics.py -> build/lib.macosx-10.6-x86_64-2.7/poppy/tests
生成默认的 poppy.cfg 文件
复制 poppy/poppy.cfg -> build/lib.macosx-10.6-x86_64-2.7/poppy
Traceback(最近一次通话最后一次):
文件“”,第 1 行,在
文件“/Users/ME/Library/Enthought/Canopy_64bit/User/build/poppy/setup.py”,第 144 行,在
use_2to3=False
文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/core.py”,第 152 行,在设置中
dist.run_commands()
文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/dist.py”,第 953 行,在 run_commands 中
self.run_command(cmd)
文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/dist.py”,第 972 行,在 run_command 中
cmd_obj.run()
文件“/Users/ME/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/setuptools/command/install.py”,第 53 行,运行中
return _install.run(self)
文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/command/install.py”,第 563 行,运行中
self.run_command('build')
文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/cmd.py”,第 326 行,在 run_command 中
self.distribution.run_command(command)
文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/dist.py”,第 972 行,在 run_command 中
cmd_obj.run()
文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/command/build.py”,第 127 行,运行中
self.run_command(cmd_name)
文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/cmd.py”,第 326 行,在 run_command 中
self.distribution.run_command(command)
文件“/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/dist.py”,第 972 行,在 run_command 中
cmd_obj.run()
文件“/Users/ME/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/astropy/setup_helpers.py”,第 631 行,运行中
对于 k, (fnsrc, v) 在 Six.iteritems(self.distribution.command_options['pytest']) 中: 键错误:'pytest' -------------------------------------- 打扫干净... 命令 /Users/ME/Library/Enthought/Canopy_64bit/User/bin/python -c "import setuptools, tokenize;__file__='/Users/ME/Library/Enthought/Canopy_64bit/User/build/poppy/setup.py'; exec( compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record / var/folders/-G/-GUFgmQKF2ysFZMLTUvftE+++TI/-Tmp-/pip-CyYl8x-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/ME /Library/Enthought/Canopy_64bit/User/include/site/python2.7 失败,错误代码 1 在 /Users/ME/Library/Enthought/Canopy_64bit/User/build/poppy 在 /Users/ME/.pip/pip.log 中存储失败的调试日志【问题讨论】:
-
不确定这是否会有所帮助,但您使用的是旧版/早期版本的 Canopy (1.1.0)。我建议你先更新到 Canopy 1.4.1。完全重新安装(最干净,请参阅support.enthought.com/entries/23580651-Uninstalling-Canopy)或从 Canopy 帮助菜单更新。
标签: python module installation enthought canopy