错误pyfits安装:/ tmp / pip-install-zMkboe / pyfits /中的命令“ python setup.py egg_info”失败,错误代码为1

时间:2019-03-04 20:13:00

标签: python python-2.7 pip pyfits

上下文

我在使用healpy时遇到了问题,这让我感到沮丧:

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

检查后,我能够看到healpy的'read_map'函数是由healpy.fitsfunc提供的,当我尝试专门导入此模块时:

import healpy.fitsfunc

我获得了:

Traceback (most recent call last):

  File "<ipython-input-1-1ab0f97bea12>", line 1, in <module>
    import healpy.fitsfunc

  File "/home/magdy/Documents/StageM1/cosmicvoids-vide_public-82492565081e/ext_build/python/lib/python2.7/site-packages/healpy/fitsfunc.py", line 23, in <module>
    import pyfits as pf

ImportError: No module named pyfits

这是我尝试安装pyfits的原因。

错误

当我尝试

pip install pyfits

我获得了:

Collecting pyfits
  Using cached https://files.pythonhosted.org/packages/c0/5d/ffae283cea526bce7c1154e7309a040a3e8c02e973b2360bcfc8f30134ef/pyfits-3.5.tar.gz
    Complete output from command python setup.py egg_info:

    Installed /tmp/easy_install-HZAa1H/stsci.distutils-0.3.7/.eggs/d2to1-0.2.12.post1-py2.7.egg
    /usr/local/lib/python2.7/dist-packages/setuptools/dist.py:47: DistDeprecationWarning: Do not call this function
      warnings.warn("Do not call this function", DistDeprecationWarning)
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-QgcwJz/pyfits/setup.py", line 14, in <module>
        zip_safe=False
      File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 144, in setup
        _install_setup_requires(attrs)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 139, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 724, in fetch_build_eggs
        replace_conflicting=True,
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 782, in resolve
        replace_conflicting=replace_conflicting
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1065, in best_match
        return self.obtain(req, installer)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1077, in obtain
        return installer(requirement)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 791, in fetch_build_egg
        return cmd.easy_install(req)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 679, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 705, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 890, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1158, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1146, in run_setup
        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error in setup command: Error parsing /tmp/easy_install-HZAa1H/stsci.distutils-0.3.7/setup.cfg: TypeError: super() argument 1 must be type, not None

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-QgcwJz/pyfits/

我已经尝试过:

pip install --upgrade setuptools

还有许多其他解决方案,但似乎没有一个适用于我的情况。

我还尝试直接下载pyfits3.5并使用

安装
pip install .

但这给了我同样的错误。

系统

Ubuntu 18.04.2 LTS(双启动)

pip 19.0.3 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)

Python 2.7.15rc1

谢谢您的帮助。

0 个答案:

没有答案