python: error while loading shared libraries: libpython3.4m.so.1.0: cannot open shared object file: No such file or directory

后端 未结 9 1566
别那么骄傲
别那么骄傲 2021-02-02 07:36

I have created a python virtual environment using virtualenv, after activating it, I can see where is Python installed in my shell as following:



        
相关标签:
9条回答
  • 2021-02-02 08:24

    Try adding the python3.4's lib path to the $LD_LIBRARY_PATH environment variable.

    First find out the lib path of python3.4 (depends on how you installed python3.4)

    For me it was: /opt/python361/lib, then add it to environment variable like so:

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/python361/lib
    

    P.S. I came across a similar problem while using virtualenv with python3.6, and I fixed it like so:

    • First, append include <lib path of python3.x> to /etc/ld.so.conf (Something like: include /opt/python361/lib or include /usr/local/lib)
    • Then, activate the new configuration by running sudo /sbin/ldconfig -v.
    0 讨论(0)
  • 2021-02-02 08:24

    For me, libpython3.6m.so.1.0 was in the folder where I downloaded Python source (~/Python3.6.9).

    I simply did : sudo cp ~/Python3.6.9/libpython3.6m.so.1.0 /usr/local/lib/python3.6/

    and : export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/python3.6

    0 讨论(0)
  • 2021-02-02 08:33

    export LD_LIBRARY_PATH=[your python path to libpython3.4m.so]

    libpython3.4m.so is under your python source from which you built it.

    Put it in your .bashrc to set it at login automatically.

    I can't force virtualenv to 3.4 on my machine but you can see that under lib of your virtualenv there's just a bunch of symlink to your local python installation. I guess libpython3.4m.so is fetch by one of those.

    0 讨论(0)
提交回复
热议问题