【问题标题】:How do I install mod_wsgi on Mac (High Sierra)?如何在 Mac (High Sierra) 上安装 mod_wsgi?
【发布时间】:2019-02-12 22:30:16
【问题描述】:

我在这个版本的 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'

【问题讨论】:

  • Requirement already satisfied: mod_wsgi in /Users/davea/Documents/workspace/mainpage_project/venv/lib/python3.7/site-packages (4.6.5) ?

标签: python python-3.x apache mod-wsgi wsgi


【解决方案1】:

以下链接中列出的说明适用于 OSX 10.14 (Mojave):

https://modwsgi.readthedocs.io/en/develop/user-guides/installation-on-macosx.html

根据您的输出,您似乎遇到了一些权限问题。

【讨论】:

  • 这些说明不起作用,因为添加模块所需的包 -- "--with-apxs=/usr/sbin/apxs" 不是 Mac 版本的 Apache 的标准配置。显然也不可能将 apxs 安装为附加组件。
  • Gotcha - 您的 OSX 版本可能就是这种情况。此解决方案可能对您有用:stackoverflow.com/questions/4341769/… – 祝您好运!
猜你喜欢
  • 1970-01-01
  • 2018-05-09
  • 2018-06-02
  • 2018-06-18
  • 2021-06-25
  • 2019-05-19
  • 1970-01-01
  • 2018-11-01
  • 2019-07-25
相关资源
最近更新 更多