when I run Django project or any code related to Postgres :
Referenced from: '/Users/mahmoudnasser/.local/share/virtualenvs/wyspp_backend-PwdII1PB/lib/python3.8/site-packages/psycopg2/_psycopg.cpython-38-darwin.so'
Reason: tried: '/opt/homebrew/opt/postgresql/lib/libpq.5.dylib' (no such file), '/usr/local/lib/libpq.5.dylib' (no such file), '/usr/lib/libpq.5.dylib' (no such file)
I tried many solutions online but none of them worked.
Note: I use MacOS
I have just encountered with this problem after upgrade Postgres with homwbrew. So I try to reinstall psycopg2 in my venv and that's solve it. Now it's ok. Just try:
pip install --upgrade --force-reinstall psycopg2
To solve this problem just run the following command:
sudo mkdir -p /usr/local/lib && sudo ln -s /opt/homebrew/opt/postgresql@14/lib/postgresql@14/libpq.5.dylib /usr/local/lib/libpq.5.dylib
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With