我对编程还不是很有经验。我正试图将这个模块安装到Canopy上,我遇到了一些麻烦(POPPY,一个物理光学仿真模块)。安装说明(找到here)告诉我进行pip安装,我在下面做。错误消息说我需要astropy模块。我在Canopy上安装了astropy,但这似乎没有认识到这一点。
我是否需要在其他地方安装astropy模块?
以下是它的说法:
ME$ pip install poppy --upgradeDownloading/unpacking poppy Downloading poppy-0.3.tar.gz (1.6MB): 1.6MB downloaded Running setup.py egg_info for package poppy Traceback (most recent call last): File "", line 16, in File "/private/var/folders/-G/-GUFgmQKF2ysFZMLTUvftE+++TI/-Tmp-/pip_build_ME/poppy/setup.py", line 12, in "module" import astropy ImportError: No module named astropy Complete output from command python setup.py egg_info: Traceback (most recent call last):
File "", line 16, in
File "/private/var/folders/-G/-GUFgmQKF2ysFZMLTUvftE+++TI/-Tmp-/pip_build_ME/poppy/setup.py", line 12, in
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
I'm not sure if this is related, but I also tried "pip install poppy" (without "--upgrade"). The error was a bit different, but presumably related. Here's what it gave:
ME$ pip install poppy Downloading/unpacking poppy Downloading poppy-0.3.tar.gz (1.6MB): 1.6MB downloaded Running setup.py (path:/Users/ME/Library/Enthought/Canopy_64bit/User/build/poppy/setup.py) egg_info for package poppy WARNING: AstropyDeprecationWarning: astropy.setup_helpers.update_package_files is deprecated. Update your setup.py to use astropy.setup_helpers.get_package_info instead. [astropy.setup_helpers]
Installing collected packages: poppy Running setup.py install for poppy WARNING: AstropyDeprecationWarning: astropy.setup_helpers.update_package_files is deprecated. Update your setup.py to use astropy.setup_helpers.get_package_info instead. [astropy.setup_helpers] generating default poppy.cfg file Traceback (most recent call last): File "", line 1, in File "/Users/ME/Library/Enthought/Canopy_64bit/User/build/poppy/setup.py", line 144, in use_2to3=False File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/core.py", line 152, in setup dist.run_commands() File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/dist.py", line 953, in run_commands self.run_command(cmd) File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/Users/ME/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/setuptools/command/install.py", line 53, in run return _install.run(self) File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/command/install.py", line 563, in run self.run_command('build') File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/cmd.py", line 326, in run_command self.distribution.run_command(command) File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/command/build.py", line 127, in run self.run_command(cmd_name) File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/cmd.py", line 326, in run_command self.distribution.run_command(command) File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/Users/ME/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/astropy/setup_helpers.py", line 631, in run for k, (fnsrc, v) in six.iteritems(self.distribution.command_options['pytest']): KeyError: 'pytest' Complete output from command /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: WARNING: AstropyDeprecationWarning: astropy.setup_helpers.update_package_files is deprecated. Update your setup.py to use astropy.setup_helpers.get_package_info instead. [astropy.setup_helpers]
running install
running build
running build_py
creating build
creating build/lib.macosx-10.6-x86_64-2.7
creating build/lib.macosx-10.6-x86_64-2.7/poppy
copying poppy/init.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
copying poppy/conf.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
copying poppy/cython_version.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
copying poppy/fwcentroid.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
copying poppy/instrument.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
copying poppy/matrixDFT.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
copying poppy/poppy_core.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
copying poppy/utils.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
copying poppy/version.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
copying poppy/wfe.py -> build/lib.macosx-10.6-x86_64-2.7/poppy
creating build/lib.macosx-10.6-x86_64-2.7/poppy/tests
copying poppy/tests/init.py -> build/lib.macosx-10.6-x86_64-2.7/poppy/tests
copying poppy/tests/test_core.py -> build/lib.macosx-10.6-x86_64-2.7/poppy/tests
copying poppy/tests/test_fft.py -> build/lib.macosx-10.6-x86_64-2.7/poppy/tests
copying poppy/tests/test_nonsquare.py -> build/lib.macosx-10.6-x86_64-2.7/poppy/tests
copying poppy/tests/test_optics.py -> build/lib.macosx-10.6-x86_64-2.7/poppy/tests
generating default poppy.cfg file
copying poppy/poppy.cfg -> build/lib.macosx-10.6-x86_64-2.7/poppy
Traceback (most recent call last):
File "", line 1, in
File "/Users/ME/Library/Enthought/Canopy_64bit/User/build/poppy/setup.py", line 144, in
use_2to3=False
File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/Users/ME/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/setuptools/command/install.py", line 53, in run
return _install.run(self)
File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/command/install.py", line 563, in run
self.run_command('build')
File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/command/build.py", line 127, in run
self.run_command(cmd_name)
File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/Users/ME/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/astropy/setup_helpers.py", line 631, in run
for k, (fnsrc, v) in six.iteritems(self.distribution.command_options['pytest']): KeyError: 'pytest' ---------------------------------------- Cleaning up... Command /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 failed with error code 1 in /Users/ME/Library/Enthought/Canopy_64bit/User/build/poppy Storing debug log for failure in /Users/ME/.pip/pip.log
答案 0 :(得分:0)
Python社区中有一个自定义,可以使用requirements.txt
文件来满足特定包的要求。然后做pip install -U -r requirements.txt
。如果该文件不存在(在poppy
源中),您可以先pip install astropy
先安装依赖项。
然而,我不得不说我使用Anaconda Scientific Python发行版比使用Canopy有更好的全面体验。也许你应该试一试。