【Python】Windows+Apacheでmod_wsgiを使えるようにする(書きかけ)
mod_wsgi を Windows にインストールするには、
コマンドプロンプトから「pip install mod_wsgi」を実行します。
それが成功するまでの道のりを書いておきます。
※まだ成功の途中です。
pip は Python 2.7.9 以降、Python 3.4 以降からデフォルトで付属しています。
なので、現時点での最新版 Python 3.6.4 をインストールします。
Python 3.6.4 の pip は、バージョン 9.0.1 ですが、
9.0.3 が利用可能なので、pip のアップデートをします。
python -m pip install –upgrade pip
をコマンドプロンプトから実行します。
Collecting pip
Downloading pip-9.0.3-py2.py3-none-any.whl (1.4MB)
100% |????????????????????????????????| 1.4MB 193kB/s
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
Successfully uninstalled pip-9.0.1
Successfully installed pip-9.0.3
あらためて実行してみると
pip install mod_wsgi
RuntimeError: No Apache installation can be found. Set the MOD_WSGI_APACHE_ROOTDIR environment to its location.
上記のエラーが出てインストールに失敗
pip install mod_wsgi, How to Set MOD_WSGI_APACHE_ROOTDIR environment?
https://stackoverflow.com/questions/42323817/pip-install-mod-wsgi-how-to-set-mod-wsgi-apache-rootdir-environment
http://modwsgi.readthedocs.io/en/develop/release-notes/version-4.5.12.html
上記の記事を読んで、Apache のインストール先を探しに行く際に
C ドライブではないからエラーが出ているようなので、インストール先を指定してあげます。
set “MOD_WSGI_APACHE_ROOTDIR=d:\Apache24"
pip install mod_wsgi
として実行。
Exception:
Traceback (most recent call last):
File "d:\python\python36\lib\site-packages\pip\compat\__init__.py", line 73,
n console_to_str
return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 71: invali
start byte
During handling of the above exception, another exception occurred:
pipでUnicodeDecodeErrorが発生(Windows環境)
https://qiita.com/akabei/items/da70ebf61cc413d5ff0d
上記の記事を参考にして
chcp コマンドで「65001」を指定して、
コマンドプロンプトの文字コードを「UTF-8」に変更します。
これでも、またエラーが出てインストールできず。
copying docs\_buil--- Logging error ---
Traceback (most recent call last):
File "d:\python\python36\lib\logging\__init__.py", line 994, in emit
stream.write(msg)
File "d:\python\python36\lib\site-packages\pip\_vendor\colorama\ansitowin32.py", line 141, in write
self.write_and_convert(text)
File "d:\python\python36\lib\site-packages\pip\_vendor\colorama\ansitowin32.py
", line 169, in write_and_convert
self.write_plain_text(text, cursor, len(text))
File "d:\python\python36\lib\site-packages\pip\_vendor\colorama\ansitowin32.py
", line 174, in write_plain_text
self.wrapped.write(text[start:end])
また時間が出来たら、調べてみます。