python2.7使用pip安装python守护进程包

时间:2017-03-25 12:55:46

标签: python python-2.7 pip

当我尝试安装python daemon package时,我始终遇到此错误(通过使用pip命令安装并使用pip下载并使用pip进行安装):

pip install python-daemon-2.1.2.tar.gz

Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/7p/x12ctdl94d59qnm_chhj2y240000gn/T/pip-2bGssA-build/setup.py", line 86, in <module>
        "Topic :: Software Development :: Libraries :: Python Modules",
      File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "version.py", line 640, in __init__
        super(ChangelogAwareDistribution, self).__init__(*args, **kwargs)
      File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 317, in __init__
        self.fetch_build_eggs(attrs['setup_requires'])
      File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 372, in fetch_build_eggs
        replace_conflicting=True,
      File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 851, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1123, in best_match
        return self.obtain(req, installer)
      File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1135, in obtain
        return installer(requirement)
      File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 438, in fetch_build_egg
        cmd.ensure_finalized()
      File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
        self.finalize_options()
      File "/usr/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 251, in finalize_options
        'dist_version': self.distribution.get_version(),
      File "version.py", line 656, in get_version
        version_info = self.get_version_info()
      File "version.py", line 651, in get_version_info
        changelog_path = get_changelog_path(self)
      File "version.py", line 552, in get_changelog_path
        setup_dirname = os.path.dirname(distribution.script_name)
      File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 122, in dirname
        i = p.rfind('/') + 1
    AttributeError: 'NoneType' object has no attribute 'rfind'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/7p/x12ctdl94d59qnm_chhj2y240000gn/T/pip-2bGssA-build/

我是python的新手,搜索错误代码并使用其他线程提供的步骤并没有解决问题。

1 个答案:

答案 0 :(得分:2)

只需撰写pip install python-daemon==2.1.2

即可

使用pip从PyPI安装时无需下载python-daemon-2.1.2.tar.gz文件。

如果要使用下载的软件包进行安装,请按照以下步骤操作

  1. tar xvf python-daemon-2.1.2.tar.gz
  2. cd python-daemon-2.1.2
  3. python setup.py install