我正在Django中编写一个使用以下第三方库的Web应用程序:
Django==1.6.1
argparse==1.2.1
cffi==0.8.1
pycparser==2.10
pylast==0.5.11
pyspotify==2.0.0a1
wsgiref==0.1.2
我一直在用sudo pip install git+git://github.com/mopidy/pyspotify.git
安装pyspotify,因为我想要开发版。
当我在本地运行Django应用程序时,一切都按预期工作。当我将更改提取到我的Apache服务器pip install -r requirements.txt
时,重新启动服务器并访问IP我收到以下错误:
Environment:
Request Method: GET
Request URL: http://ec2-54-196-205-226.compute-1.amazonaws.com/
Django Version: 1.6.1
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'raudio')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
101. resolver_match = resolver.resolve(request.path_info)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in resolve
320. sub_match = pattern.resolve(new_path)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in resolve
222. return ResolverMatch(self.callback, args, kwargs, self.name)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in callback
229. self._callback = get_callable(self._callback_str)
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py" in wrapper
32. result = func(*args)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in get_callable
96. mod = import_module(mod_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in import_module
40. __import__(name)
File "/home/ubuntu/public_html/clupus.com/clupus/raudio/views.py" in <module>
9. import spotify
File "/usr/local/lib/python2.7/dist-packages/spotify/__init__.py" in <module>
53. ext_package='spotify')
File "/usr/local/lib/python2.7/dist-packages/cffi/api.py" in verify
339. lib = self.verifier.load_library()
File "/usr/local/lib/python2.7/dist-packages/cffi/verifier.py" in load_library
73. self._write_source()
File "/usr/local/lib/python2.7/dist-packages/cffi/verifier.py" in _write_source
125. file = open(self.sourcefilename, 'w')
Exception Type: IOError at /
Exception Value: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/spotify/__pycache__/_cffi__x3868ddbbx77caf6c5.c'
当我在服务器上pip freeze
时,所有依赖关系都会出现,所以我不确定问题是什么。有没有人有想法?
答案 0 :(得分:5)
假设您遇到与尝试安装时相同的编译器错误:
c/_cffi_backend.c:14:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
我通过apt-get install libffi-dev
答案 1 :(得分:0)
我的问题中的评论建议我重新安装pyspotify。我试着这样做了gcc error。第5行告诉我们问题在于libspotify,这是一个pyspotify所依赖的库。我以为我安装了但显然不是。我安装了它,重新启动了服务器,现在一切正常。