以前も同じような質問をしました。しかし今回は、別の異なる事で悩んでいます。ご教授をお願いします。
python3を以下のように構築し、venv環境を/home/ubuntu/envで構築しました。サーバはubuntu16です。
sudo apt-get -y install build-essential libsqlite3-dev libreadline6-dev libgdbm-dev zlib1g-dev libbz2-dev sqlite3 tk-dev zip libssl-dev gfortran liblapack-dev リスト 1.2 Python 3.6.1のソースからのインストール $ wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz $ tar axvf ./Python-3.6.1.tgz $ cd ./Python-3.6.1/ $ LDFLAGS="-L/usr/lib/x86_64-linux-gnu" ./configure --with-ensurepip $ make $ sudo make install リスト 1.3 Pythonのバージョン確認 $ hash -r $ python3 -V Python 3.6.1 /usr/local/bin/python3 -m venv env source env/bin/activate
その後、こちらのサイトを参考に以下の設定を行いました。
http://qiita.com/makky05/items/98b86ca36776a524dfc9
sudo apt-get install apache2 sudo apt-get install libapache2-mod-wsgi-py3
// /home/hoge/hello.py
import sys def application(environ, start_response): status = '200 OK' output = b'Hello World! python version : ' + sys.version.encode("utf-8") response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))] start_response(status, response_headers) return [output]
// /etc/apache2/sites-available/python.conf
LoadModule wsgi_module modules/mod_wsgi.so WSGIScriptAlias / /home/ubuntu/hello.py WSGIPythonPath /home/ubuntu/./env/lib/python3.6/site-packages <Directory /home/ubuntu> Require all granted </Directory>
$ sudo a2ensite python.conf $ sudo service apache2 start
そして、上記の作業を行いました。サイトにアクセスすると、以下の結果になりました。
// http://192.168.33.11にアクセス
どうも、libapache2-mod-wsgi-py3はubuntuデフォルトでインストールされているpython3.5.2に反応しているようです。
なので、mod_wsgiをソースからインストールしました。
cd $ wget https://github.com/GrahamDumpleton/mod_wsgi/archive/4.4.13.tar.gz $ tar zxvf 4.5.17.tar.gz $ mv mod_wsgi-4.5.17 /usr/local/src $ cd /usr/local/src/mod_wsgi-4.5.15 $./configure LDFLAGS='-Wl,-rpath=/home/kou/./env/lib' $ make $ sudo make install
ソースから、mod_wsgiをインストールしましたが、設定は、変更していません。
しかし、apache2を再起動しましたが、エラーになりうまく起動しませんでした。
ここから、質問です。
ソースからインストールしたpython3.6に対応したmod_wsgiのインストール方法を教えてください。
お願いします。
ちなみに、pipでインストールすると以下のようなエラーになりうまく行きません。
ubuntu@ubuntu-xenial:~$ pip install mod_wsgi Collecting mod_wsgi Using cached mod_wsgi-4.5.17.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-rf_k0m_2/mod-wsgi/setup.py", line 164, in <module> 'missing Apache httpd server packages.' % APXS) RuntimeError: The 'apxs' command appears not to be installed or is not executable. Please check the list of prerequisites in the documentation for this package and install any missing Apache httpd server packages. Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook from apport.fileutils import likely_packaged, get_recent_crashes File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module> from apport.report import Report File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module> import apport.fileutils File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module> from apport.packaging_impl import impl as packaging File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module> import apt File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module> import apt_pkg ModuleNotFoundError: No module named 'apt_pkg' Original exception was: Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-rf_k0m_2/mod-wsgi/setup.py", line 164, in <module> 'missing Apache httpd server packages.' % APXS) RuntimeError: The 'apxs' command appears not to be installed or is not executable. Please check the list of prerequisites in the documentation for this package and install any missing Apache httpd server packages. ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-rf_k0m_2/mod-wsgi/

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/08/15 07:18
2017/08/15 15:21 編集
2017/08/15 15:46