2014-01-16 183 views
3

我正在寫在Django的web應用程序,使用下面的第三方庫上:的IOError生產服務器

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因爲我想dev的版本。

當我在本地運行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所有的依賴顯得遇到了在服務器上,我不知道是什麼問題是。有人有想法嗎?

+1

該問題具體與pyspotify。嘗試重新安裝該軟件包? – yuvi

+0

pyspotify-2.0.0a1位於何處?如果我嘗試點擊安裝您的requirements.txt,我會得到'找不到滿足要求pyspotify == 2.0.0a1的版本。如果它來自不同的存儲庫,則需要執行'pip install -f http://other.repo.com -r requirements.txt' – ptr

+0

我一直在手動安裝'sudo pip install git + git:// github.com/mopidy/pyspotify.git'。現在,當我嘗試這樣做時,它會告訴我'命令'gcc'以退出狀態1'失敗。 – Nanor

回答

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 

我發現修復hereapt-get install libffi-dev

+0

修正了這個問題,即使我以爲是libspotify也沒有安裝。 – Nanor

0

在我的問題中留言建議我重新安裝pyspotify。我試圖這樣做,並得到gcc error。第5行告訴我們,問題出在libspotify上,這是一個pyspotify依賴的庫。我以爲我已經安裝了,但顯然不是。我安裝了它,重新啓動了服務器,現在一切按預期工作。