简体   繁体   中英

How do I install mod_wsgi on Mac (High Sierra)?

I'm using Mac 10.13.6 (High Sierra) with this version of Apache ...

localhost:mod_wsgi-4.6.5 davea$ httpd -version
Server version: Apache/2.4.33 (Unix)
Server built:   Apr  3 2018 17:54:07

How do I install the mod_wsgi module so that Apache can load my Python site? I tried using pip but got the most baffling permission errors despite the fact I'm using 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'

The instructions outlined under the link below, work under OSX 10.14 (Mojave):

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

Based on your output, it seems you are hitting some permission issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM