2015-04-15 82 views
1

我試圖按照http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html的教程進行操作。我已經完成了一切工作,以便進入http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html#install-uwsgi-system-wide。我與在Amazon EC2上使用Ubuntu 14.4實例工作:在/ tmp/pip_build_root/uwsgi中編譯失敗,顯示錯誤代碼1

沒有進入我的virtualenv,我跑:

sudo pip install uwsgi 

這導致:

---------------------------------------- 
Cleaning up... 
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/uwsgi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-64P2dl-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/uwsgi 
Storing debug log for failure in /home/ubuntu/.pip/pip.log 

日誌有:

Cleaning up... 
    Removing temporary dir /tmp/pip_build_ubuntu... 
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-uLEPHb-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-hPh8D0-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-uLEPHb-build 
Exception information: 
Traceback (most recent call last): 
    File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main 
    status = self.run(options, args) 
    File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run 
    requirement_set.install(install_options, global_options, root=options.root_path) 
    File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1435, in install 
    requirement.install(install_options, global_options, *args, **kwargs) 
    File "/usr/lib/python2.7/dist-packages/pip/req.py", line 706, in install 
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False) 
    File "/usr/lib/python2.7/dist-packages/pip/util.py", line 697, in call_subprocess 
    % (command_desc, proc.returncode, cwd)) 
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-uLEPHb-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-hPh8D0-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-uLEPHb-build 

我在做什麼錯?

+0

如果pip能夠正常工作,請嘗試安裝別的設備。然後(你應該已經做到了)嘗試爲uwsgi安裝一些依賴項(但我想你已經做到了)。 'apt-get install build-essential python'或'apt-get install python-dev'。如果它仍然會拋出InstallationError,那麼您可能需要找到另一種方法來安裝uwsgi。或者等到有人更有能力回答你的問題。 – Lucas03

+0

感謝您期待它,但迄今爲止沒有運氣。 – user61629

+0

對於我嘗試使用pip進行安裝的所有內容,我都遇到了同樣的錯誤,而且我最近更改了/ tmp /文件夾的權限。我很確定這與它有關,儘管我不確定爲什麼/如何解決它。 –

回答

6

可能有點晚,以回答你的問題,但把我的答案可以幫助人們以後。

我回頭看了看日誌,看到了這些行。

 
[x86_64-linux-gnu-gcc -In file included from plugins/python/python_plugin.c:1:0: 
plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory 
#include 
       ^
compilation terminated. 

原來,它找不到Python.h。安裝python2.7-dev解​​決了我的問題。

 
apt-get install -y python2.7-dev 
+0

修復了這個問題 – TheBurgerShot

+0

'apt-get install -y python3-dev'也適用於python3環境 – securecurve

相關問題