I am deploying a django server.

I've already installed python 3.5 without errors, but for some problems when I tried to compile mod_wsgi (so I could share the django app in an intranet environment with apache):

./configure --with-python=/usr/local/bin/python3.5

it told me that Failed to locate the Python library /usr/local/lib/libpython3.3m.so.

Searching for the solution on Google, I found this solution explaining that I needed to recompile python3 with --enable-shared flag.

so, I proceeded to remove python3 and python3.5 from /usr/local/bin and recompiled python3. Everything was fine, until I tried to check the python version with python3 --version and I got the following:

[rortega@Production Python-3.5.2]$ python3 --version
python3: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory

I can't find any solution to this.

  • 2
    ldd $(type -p python3) might give you some insights. Oct 27, 2016 at 19:50
  • is the libpython3.5m.so.1.0 marked as not found. the problem now is the it is in the correct location, but for some reason it doesn read it Oct 27, 2016 at 21:15

1 Answer 1


Your system may not be looking in /usr/local/lib by default for shared libraries. When you compile things, set the environment variable:

export LD_RUN_PATH=/usr/local/lib

This is only needed when you compile things.

That or add /usr/local/lib to the directories searched by the system for shared libraries.

  • libpython3.5m.so.1.0 is indeed in /usr/local/lib. i recompiled python3 after executinr the command you gave, but i get the same error =( Oct 27, 2016 at 21:00
  • i just saw this and you helped with that issue, what a coincidence from 1 year appart. ill follow what it says and ill let you know the results. Oct 27, 2016 at 21:34
  • GREAT!!! I been working on this issue all day, i followed this > ../configure --prefix=/usr/local --enable-shared --with-threads > LD_RUN_PATH=/usr/local/lib make > sudo make install and it did the thing. Thank you so much Oct 27, 2016 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.