我在此版本的Apache上使用Mac 10.13.6(High Sierra)...
localhost:mod_wsgi-4.6.5 davea$ httpd -version
Server version: Apache/2.4.33 (Unix)
Server built: Apr 3 2018 17:54:07
如何安装mod_wsgi模块,以便Apache可以加载我的Python站点?我尝试使用pip,但是尽管我使用sudo,但还是遇到了最令人困惑的权限错误。
(venv) localhost:tmp davea$ sudo pip install mod_wsgi
The directory '/Users/davea/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/davea/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: mod_wsgi in /Users/davea/Documents/workspace/mainpage_project/venv/lib/python3.7/site-packages (4.6.5)
You are using pip version 19.0.1, however version 19.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(venv) localhost:tmp davea$
(venv) localhost:tmp davea$ sudo mod_wsgi-express install-module
Traceback (most recent call last):
File "/Users/davea/Documents/workspace/mainpage_project/venv/bin/mod_wsgi-express", line 11, in <module>
load_entry_point('mod-wsgi==4.6.5', 'console_scripts', 'mod_wsgi-express')()
File "/Users/davea/Documents/workspace/mainpage_project/venv/lib/python3.7/site-packages/mod_wsgi/server/__init__.py", line 3570, in main
cmd_install_module(args)
File "/Users/davea/Documents/workspace/mainpage_project/venv/lib/python3.7/site-packages/mod_wsgi/server/__init__.py", line 3508, in cmd_install_module
shutil.copyfile(where(), target)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/shutil.py", line 121, in copyfile
with open(dst, 'wb') as fdst:
PermissionError: [Errno 1] Operation not permitted: '/usr/libexec/apache2/mod_wsgi-py37.cpython-37m-darwin.so'
答案 0 :(得分:0)
以下链接下概述的说明可在OSX 10.14(Mojave)下使用:
https://modwsgi.readthedocs.io/en/develop/user-guides/installation-on-macosx.html
根据您的输出,看来您遇到了一些权限问题。