尝试使用 pip 为 mopidy 安装 mopidy-spotify 插件

尝试使用 pip 为 mopidy 安装 mopidy-spotify 插件

我正在尝试mopidy-spotify使用以下方式安装插件:

sudo pip install -U mopidy-spotify

我收到了一堆错误:

Collecting mopidy-spotify
  Using cached Mopidy_Spotify-3.0.0-py2.py3-none-any.whl
Requirement already up-to-date: Mopidy>=2.0 in /usr/lib64/python2.7/site-packages (from mopidy-spotify)
Collecting pyspotify>=2.0.5 (from mopidy-spotify)
  Using cached pyspotify-2.0.5.tar.gz
    Complete output from command python setup.py egg_info:
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
     #include <ffi.h>
                     ^
    compilation terminated.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-gRr0Vz/pyspotify/setup.py", line 46, in <module>
        'Topic :: Software Development :: Libraries',
      File "/usr/lib64/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 315, in __init__
        self.fetch_build_eggs(attrs['setup_requires'])
      File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 361, in fetch_build_eggs
        replace_conflicting=True,
      File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 853, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1125, in best_match
        return self.obtain(req, installer)
      File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1137, in obtain
        return installer(requirement)
      File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 429, in fetch_build_egg
        return cmd.easy_install(req)
      File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 665, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 695, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 876, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1115, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1103, in run_setup
        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-gRr0Vz/pyspotify/

有任何想法吗?我能够mopidy通过 pip 安装没有问题,但是当尝试获取任何插件时,我收到这些错误。

编辑

我按照 Jakuje 的建议安装了 libffi-devel 软件包。下次我运行 sudo pip install -U mopidy-spotify 时,它安装了一些依赖项,然后提出了这个块;

Collecting mopidy-spotify
  Using cached Mopidy_Spotify-3.0.0-py2.py3-none-any.whl
Requirement already up-to-date: Mopidy>=2.0 in /usr/lib64/python2.7/site-packages (from mopidy-spotify)
Collecting pyspotify>=2.0.5 (from mopidy-spotify)
  Using cached pyspotify-2.0.5.tar.gz
Collecting setuptools (from mopidy-spotify)
  Using cached setuptools-28.2.0-py2.py3-none-any.whl
Requirement already up-to-date: requests>=2.0 in /usr/lib/python2.7/site-packages (from mopidy-spotify)
Requirement already up-to-date: Pykka>=1.1 in /usr/lib/python2.7/site-packages (from mopidy-spotify)
Collecting tornado>=2.3 (from Mopidy>=2.0->mopidy-spotify)
  Using cached tornado-4.4.2.tar.gz
Requirement already up-to-date: cffi>=1.0.0 in /usr/lib64/python2.7/site-packages (from pyspotify>=2.0.5->mopidy-spotify)
Requirement already up-to-date: singledispatch in /usr/lib/python2.7/site-packages (from tornado>=2.3->Mopidy>=2.0->mopidy-spotify)
Requirement already up-to-date: certifi in /usr/lib/python2.7/site-packages (from tornado>=2.3->Mopidy>=2.0->mopidy-spotify)
Requirement already up-to-date: backports_abc>=0.4 in /usr/lib/python2.7/site-packages (from tornado>=2.3->Mopidy>=2.0->mopidy-spotify)
Requirement already up-to-date: pycparser in /usr/lib/python2.7/site-packages (from cffi>=1.0.0->pyspotify>=2.0.5->mopidy-spotify)
Requirement already up-to-date: six in /usr/lib/python2.7/site-packages (from singledispatch->tornado>=2.3->Mopidy>=2.0->mopidy-spotify)
Installing collected packages: pyspotify, setuptools, mopidy-spotify, tornado
  Running setup.py install for pyspotify ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-b5Vptv/pyspotify/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-OAgQwy-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/spotify
    copying spotify/playlist.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/sink.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/social.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/artist.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/session.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/album.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/_spotify_build.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/connection.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/eventloop.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/audio.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/playlist_track.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/toplist.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/offline.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/inbox.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/search.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/__init__.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/utils.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/playlist_container.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/player.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/link.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/error.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/version.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/user.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/config.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/image.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/track.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/playlist_unseen_tracks.py -> build/lib.linux-x86_64-2.7/spotify
    running egg_info
    writing requirements to pyspotify.egg-info/requires.txt
    writing pyspotify.egg-info/PKG-INFO
    writing top-level names to pyspotify.egg-info/top_level.txt
    writing dependency_links to pyspotify.egg-info/dependency_links.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'pyspotify.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    no previously-included directories found matching 'docs/_build'
    no previously-included directories found matching 'examples/tmp'
    warning: no previously-included files matching '__pycache__/*' found anywhere in distribution
    writing manifest file 'pyspotify.egg-info/SOURCES.txt'
    copying spotify/api.h -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/api.processed.h -> build/lib.linux-x86_64-2.7/spotify
    running build_ext
    generating cffi module 'build/temp.linux-x86_64-2.7/spotify._spotify.c'
    creating build/temp.linux-x86_64-2.7
    building 'spotify._spotify' extension
    creating build/temp.linux-x86_64-2.7/build
    creating build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/spotify._spotify.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/spotify._spotify.o
    build/temp.linux-x86_64-2.7/spotify._spotify.c:432:28: fatal error: libspotify/api.h: No such file or directory
     #include "libspotify/api.h"
                                ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-b5Vptv/pyspotify/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-OAgQwy-record/install-record.txt --single-version-externally-managed --compile" faile    Collecting mopidy-spotify
  Using cached Mopidy_Spotify-3.0.0-py2.py3-none-any.whl
Requirement already up-to-date: Mopidy>=2.0 in /usr/lib64/python2.7/site-packages (from mopidy-spotify)
Collecting pyspotify>=2.0.5 (from mopidy-spotify)
  Using cached pyspotify-2.0.5.tar.gz
Collecting setuptools (from mopidy-spotify)
  Using cached setuptools-28.2.0-py2.py3-none-any.whl
Requirement already up-to-date: requests>=2.0 in /usr/lib/python2.7/site-packages (from mopidy-spotify)
Requirement already up-to-date: Pykka>=1.1 in /usr/lib/python2.7/site-packages (from mopidy-spotify)
Collecting tornado>=2.3 (from Mopidy>=2.0->mopidy-spotify)
  Using cached tornado-4.4.2.tar.gz
Requirement already up-to-date: cffi>=1.0.0 in /usr/lib64/python2.7/site-packages (from pyspotify>=2.0.5->mopidy-spotify)
Requirement already up-to-date: singledispatch in /usr/lib/python2.7/site-packages (from tornado>=2.3->Mopidy>=2.0->mopidy-spotify)
Requirement already up-to-date: certifi in /usr/lib/python2.7/site-packages (from tornado>=2.3->Mopidy>=2.0->mopidy-spotify)
Requirement already up-to-date: backports_abc>=0.4 in /usr/lib/python2.7/site-packages (from tornado>=2.3->Mopidy>=2.0->mopidy-spotify)
Requirement already up-to-date: pycparser in /usr/lib/python2.7/site-packages (from cffi>=1.0.0->pyspotify>=2.0.5->mopidy-spotify)
Requirement already up-to-date: six in /usr/lib/python2.7/site-packages (from singledispatch->tornado>=2.3->Mopidy>=2.0->mopidy-spotify)
Installing collected packages: pyspotify, setuptools, mopidy-spotify, tornado
  Running setup.py install for pyspotify ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-b5Vptv/pyspotify/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-OAgQwy-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/spotify
    copying spotify/playlist.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/sink.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/social.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/artist.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/session.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/album.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/_spotify_build.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/connection.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/eventloop.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/audio.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/playlist_track.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/toplist.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/offline.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/inbox.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/search.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/__init__.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/utils.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/playlist_container.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/player.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/link.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/error.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/version.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/user.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/config.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/image.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/track.py -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/playlist_unseen_tracks.py -> build/lib.linux-x86_64-2.7/spotify
    running egg_info
    writing requirements to pyspotify.egg-info/requires.txt
    writing pyspotify.egg-info/PKG-INFO
    writing top-level names to pyspotify.egg-info/top_level.txt
    writing dependency_links to pyspotify.egg-info/dependency_links.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'pyspotify.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    no previously-included directories found matching 'docs/_build'
    no previously-included directories found matching 'examples/tmp'
    warning: no previously-included files matching '__pycache__/*' found anywhere in distribution
    writing manifest file 'pyspotify.egg-info/SOURCES.txt'
    copying spotify/api.h -> build/lib.linux-x86_64-2.7/spotify
    copying spotify/api.processed.h -> build/lib.linux-x86_64-2.7/spotify
    running build_ext
    generating cffi module 'build/temp.linux-x86_64-2.7/spotify._spotify.c'
    creating build/temp.linux-x86_64-2.7
    building 'spotify._spotify' extension
    creating build/temp.linux-x86_64-2.7/build
    creating build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/spotify._spotify.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/spotify._spotify.o
    build/temp.linux-x86_64-2.7/spotify._spotify.c:432:28: fatal error: libspotify/api.h: No such file or directory
     #include "libspotify/api.h"
                                ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-b5Vptv/pyspotify/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-OAgQwy-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-b5Vptv/pyspotify/d with error code 1 in /tmp/pip-build-b5Vptv/pyspotify/

答案1

最有可能的是你只需要安装libffi-devel

dnf install libffi-devel

它提供了缺失ffi.hlibffi.pc文件。

相关内容