Closed lugearma closed 1 month ago
For the first case, where have you got your Python distribution from? It doesn't seem to be a standard distribution from Homebrew or Python Software Foundation since they would not usually use a location under ~/Library
.
As to the second issue, you cannot use macOS system Apache httpd package as it requires signing of Apache modules. You need to use Homebrew version of Apache httpd on macOS if you have it available.
If you accidentally used macOS system Apache httpd before Homebrew Apache httpd was installed, ensure when run pip install
subsequently that you use:
pip install -U --no-cache-dir mod_wsgi
IOW, use --no-cache-dir
else it will use prior version built against macOS system Apache httpd.
About the python distribution tbh i don't remember how and where i got it :( What should I do ?? should I uninstall it and install it again ??
About the second one, how can i use the httpd from homebrew ?
I already installed using
brew install httpd
then reinstall mod_wsgi as you told me but didn't work, I got same error.
So long as you have /usr/local/bin
before macOS paths for Xcode stuff, then /usr/local/bin/apxs
should be found in your path first and use that.
If PATH
doesn't have /usr/local/bin
first or perhaps Xcode uses apxs2
instead, then the latter may be found.
From memory you can do:
APXS=/usr/local/bin/apxs pip install -U --no-cache-dir mod_wsgi
What do you get when you run:
which apxs
which apxs2
As to Python distro, since you likely have /usr/local/bin/python3
being Homebrew version, make sure it is in PATH
before your other version.
What do you get when you run:
which python3
ls -las /usr/local/bin/python*
this is what i get from each command:
which apxs
/opt/homebrew/bin/apxs
which apxs2
apxs2 not found
which python3
/usr/bin/python3
ls -las /usr/local/bin/python*
0 lrwxr-xr-x 1 root wheel 70 Aug 13 14:44 /usr/local/bin/python3 -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3
0 lrwxr-xr-x 1 root wheel 77 Aug 13 14:44 /usr/local/bin/python3-config -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3-config
0 lrwxr-xr-x 1 root wheel 78 Aug 13 14:44 /usr/local/bin/python3-intel64 -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3-intel64
0 lrwxr-xr-x 1 root wheel 73 Aug 13 14:44 /usr/local/bin/python3.12 -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12
0 lrwxr-xr-x 1 root wheel 80 Aug 13 14:44 /usr/local/bin/python3.12-config -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12-config
0 lrwxr-xr-x 1 root wheel 81 Aug 13 14:44 /usr/local/bin/python3.12-intel64 -> ../../../Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12-intel64
Make sure /usr/local/bin
is at the start of PATH
. In other words, is set as:
PATH="/usr/local/bin:$PATH"
and not:
PATH=$PATH:/usr/local/bin
That way python3
from /usr/local/bin
will be found in preference to system Python.
Otherwise ensure you use Python virtual environments and that when creating the Python virtual environment use:
/usr/local/bin/python3 -m venv path/to/venv
That way when activate the Python virtual environment will use Homebrew Python.
Closing as no further followup and so assumed was resolved.
Hi everyone,
I've got a django app, I'm building an API rest that I want to consume from an iOS app. For some reason when I send the authentication header from postman it works, but when I send from the iOS app it doesn't work. So i guees mod_wsgi can help me in this case. tbh i don't have almost any experience doing server things.
I already installed the module with
pip install mod-wsgi
. Also I already modified my apache .conf file like this:but for some reason when I run
apachectl restart
I got this error:httpd: Syntax error on line 534 of /opt/homebrew/etc/httpd/httpd.conf: Cannot load /Users/luisarias/Library/Python/3.9/lib/python/site-packages/mod_wsgi/server/mod_wsgi-py39.cpython-39-darwin.so into server: dlopen(/Users/luisarias/Library/Python/3.9/lib/python/site-packages/mod_wsgi/server/mod_wsgi-py39.cpython-39-darwin.so, 0x000A): Library not loaded: @rpath/Python3.framework/Versions/3.9/Python3\n Referenced from: <0D7390A5-B72F-3A13-A8B7-7EA7C13F7CE1> /Users/luisarias/Library/Python/3.9/lib/python/site-packages/mod_wsgi/server/mod_wsgi-py39.cpython-39-darwin.so\n Reason: no LC_RPATH's found
and also when I do
mod_wsgi-express start-server
i get sth like this:have anyone faced the same issue ?? is there anything i'm doing wrong ?? Hope someone can helpme :)
Thanks