Anaconda + Apache + mod_wsgi + Ubuntu [英] Anaconda + Apache + mod_wsgi + Ubuntu

查看:86
本文介绍了Anaconda + Apache + mod_wsgi + Ubuntu的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ubuntu和Apache运行服务器.现在,我正在尝试让Anaconda与mod_wsgi一起使用,但无法使其正常工作.

I'm running a server with Ubuntu and Apache. Now I'm trying to get Anaconda working with mod_wsgi but just can't get it to work.

首先.如果我使用mod_wsgi-express,它可以正常工作.按照安装到Python I部分中 https://anaconda.org/pypi/mod_wsgi 中的说明进行操作可以先设置PYTHONHOME=/opt/anaconda然后再设置/opt/anaconda3/bin/mod_wsgi-express start-server来使其正常工作.

First off. It is working if I use mod_wsgi-express. By following the instruction at https://anaconda.org/pypi/mod_wsgi in section Installing into Python I can get it working by first setting PYTHONHOME=/opt/anaconda and then /opt/anaconda3/bin/mod_wsgi-express start-server.

我想使用Apache,所以我将anaconda的mod_wsgi模块加载到apache中.然后我有一个VirtualHost像这样:

I want to use Apache so I load the mod_wsgi module from anaconda into apache. And then I have a VirtualHost looking like this:

WSGIPythonHome /opt/anaconda3
WSGIPythonPath /opt/anaconda3/lib/python3.6/site-packages:/path/to/application
<VirtualHost *:8080>
ServerName example.com
WSGIDaemonProcess example python-home=/opt/anaconda3 python-path=path/to/application:/opt/anaconda3/lib/python3.6/site-packages
WSGIProcessGroup example

WSGIScriptAlias / /path/to/application/wsgi.py

<Directory /path/to/application/static>
    Require all granted
</Directory>

<Directory /path/to/application>
<Files wsgi.py>
    Require all granted
</Files>
</Directory>

</VirtualHost>

现在是问题所在.我在我的Apache错误日志中收到此错误.如果未使用mod_wsgi_express指定PYTHONHOME=/opt/anaconda,则会收到相同的错误.

Now to the problem. I get this error in my apache error log. I get the same error if I don't specify PYTHONHOME=/opt/anaconda with mod_wsgi_express.

[Wed Mar 01 09:31:17.159233 2017] [core:trace4] [pid 16941] mpm_common.c(530): mpm child 19356 (gen 0/slot 1) started
[Wed Mar 01 09:31:17.159638 2017] [core:trace4] [pid 16941] mpm_common.c(530): mpm child 19357 (gen 0/slot 2) started
[Wed Mar 01 09:31:17.160049 2017] [core:trace4] [pid 16941] mpm_common.c(530): mpm child 19358 (gen 0/slot 6) started
[Wed Mar 01 09:31:17.160467 2017] [core:trace4] [pid 16941] mpm_common.c(530): mpm child 19359 (gen 0/slot 7) started
[Wed Mar 01 09:31:17.160967 2017] [core:trace4] [pid 16941] mpm_common.c(530): mpm child 19360 (gen 0/slot 8) started
[Wed Mar 01 09:31:17.161421 2017] [core:trace4] [pid 16941] mpm_common.c(530): mpm child 19361 (gen 0/slot 9) started
[Wed Mar 01 09:31:17.161877 2017] [core:trace4] [pid 16941] mpm_common.c(530): mpm child 19362 (gen 0/slot 10) started
[Wed Mar 01 09:31:17.162345 2017] [core:trace4] [pid 16941] mpm_common.c(530): mpm child 19363 (gen 0/slot 11) started
[Wed Mar 01 09:31:17.162792 2017] [wsgi:info] [pid 19361] mod_wsgi (pid=19361): Python home /opt/anaconda3.
[Wed Mar 01 09:31:17.162817 2017] [wsgi:info] [pid 19361] mod_wsgi (pid=19361): Initializing Python.
[Wed Mar 01 09:31:17.166761 2017] [wsgi:info] [pid 19362] mod_wsgi (pid=19362): Python home /opt/anaconda3.
[Wed Mar 01 09:31:17.166806 2017] [wsgi:info] [pid 19362] mod_wsgi (pid=19362): Initializing Python.
[Wed Mar 01 09:31:17.170927 2017] [wsgi:info] [pid 19360] mod_wsgi (pid=19360): Python home /opt/anaconda3.
[Wed Mar 01 09:31:17.170967 2017] [wsgi:info] [pid 19360] mod_wsgi (pid=19360): Initializing Python.
[Wed Mar 01 09:31:17.174897 2017] [wsgi:info] [pid 19359] mod_wsgi (pid=19359): Python home /opt/anaconda3.
[Wed Mar 01 09:31:17.174921 2017] [wsgi:info] [pid 19359] mod_wsgi (pid=19359): Initializing Python.
[Wed Mar 01 09:31:17.178746 2017] [wsgi:info] [pid 19363] mod_wsgi (pid=19363): Python home /opt/anaconda3.
[Wed Mar 01 09:31:17.178769 2017] [wsgi:info] [pid 19363] mod_wsgi (pid=19363): Initializing Python.
[Wed Mar 01 09:31:17.182570 2017] [core:notice] [pid 16941] AH00052: child pid 19317 exit signal Aborted (6)
[Wed Mar 01 09:31:17.182582 2017] [core:trace4] [pid 16941] mpm_common.c(530): mpm child 19317 (gen 0/slot 0) exited
[Wed Mar 01 09:31:17.182594 2017] [core:notice] [pid 16941] AH00052: child pid 19318 exit signal Aborted (6)
[Wed Mar 01 09:31:17.182597 2017] [core:trace4] [pid 16941] mpm_common.c(530): mpm child 19318 (gen 0/slot 3) exited
[Wed Mar 01 09:31:17.182605 2017] [core:notice] [pid 16941] AH00052: child pid 19319 exit signal Aborted (6)
[Wed Mar 01 09:31:17.182608 2017] [core:trace4] [pid 16941] mpm_common.c(530): mpm child 19319 (gen 0/slot 4) exited
[Wed Mar 01 09:31:17.182615 2017] [core:notice] [pid 16941] AH00052: child pid 19320 exit signal Aborted (6)
[Wed Mar 01 09:31:17.182618 2017] [core:trace4] [pid 16941] mpm_common.c(530): mpm child 19320 (gen 0/slot 5) exited
[Wed Mar 01 09:31:17.182636 2017] [wsgi:info] [pid 16941] mod_wsgi (pid=19321): Process 'store-test' has died but server is being stopped, deregister it.
[Wed Mar 01 09:31:17.182646 2017] [wsgi:info] [pid 16941] mod_wsgi (pid=19321): Process 'store-test' has been deregistered and will no longer be monitored.
[Wed Mar 01 09:31:17.182934 2017] [wsgi:info] [pid 19358] mod_wsgi (pid=19358): Python home /opt/anaconda3.
[Wed Mar 01 09:31:17.182954 2017] [wsgi:info] [pid 19358] mod_wsgi (pid=19358): Initializing Python.
[Wed Mar 01 09:31:17.186756 2017] [wsgi:info] [pid 19357] mod_wsgi (pid=19357): Python home /opt/anaconda3.
[Wed Mar 01 09:31:17.186781 2017] [wsgi:info] [pid 19357] mod_wsgi (pid=19357): Initializing Python.
[Wed Mar 01 09:31:17.190807 2017] [wsgi:info] [pid 19356] mod_wsgi (pid=19356): Python home /opt/anaconda3.
[Wed Mar 01 09:31:17.190840 2017] [wsgi:info] [pid 19356] mod_wsgi (pid=19356): Initializing Python.
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007f4ad9333780 (most recent call first):

有人知道我该怎么做才能使它正常工作吗?

Anyone know what I can do to get it working?

推荐答案

如果要使用Anaconda Python,则不能对mod_wsgi使用任何系统软件包.因此,第一步是卸载所有系统的mod_wsgi软件包.

You cannot use any system package for mod_wsgi if you are wanting to use Anaconda Python. So first step is to uninstall any system mod_wsgi package.

然后使用pip install mod_wsgimod_wsgi-express安装到您的Anaconda Python安装或虚拟环境中.

Then use pip install mod_wsgi to install mod_wsgi-express into your Anaconda Python installation or virtual environment.

然后运行:

mod_wsgi-express module-config

获取该输出,并将其放入您的Apache配置文件中以加载mod_wsgi.

Take the output of that and put it into your Apache configuration file to load mod_wsgi.

然后将特定WSGI应用程序的mod_wsgi配置添加到Apache.

Then add to Apache the mod_wsgi configuration for your specific WSGI application.

在遇到问题后,显示正在使用的配置.

Show the configuration you are using after doing that if have issues.

这篇关于Anaconda + Apache + mod_wsgi + Ubuntu的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆