How can I troubleshoot Python “Could not find platform independent libraries

前端 未结 7 1466
心在旅途
心在旅途 2020-11-28 09:59

I\'m trying to use Fontcustom to create an icon font using svg files and fontforge. I\'m on OSX.7. However, whenever I run the program I get the error

Could          


        
相关标签:
7条回答
  • 2020-11-28 10:04

    When the first lion of python script is #!/usr/bin/env python,maybe it's /usr/bin/env issue. You can run /usr/bin/env to see if error ,if it runs with error,you can update /usr/bin/env with yum(and so on) install coreutils.

    0 讨论(0)
  • 2020-11-28 10:08

    I had this issue while using Python installed with sudo make altinstall on Opensuse linux. It seems that the compiled libraries are installed in /usr/local/lib64 but Python is looking for them in /usr/local/lib.

    I solved it by creating a dynamic link to the relevant directory in /usr/local/lib

    sudo ln -s /usr/local/lib64/python3.8/lib-dynload/ /usr/local/lib/python3.8/lib-dynload
    

    I suspect the better thing to do would be to specify libdir as an argument to configure (at the start of the build process) but I haven't tested it that way.

    0 讨论(0)
  • 2020-11-28 10:16

    My pycharm ce had the same error, was easy to fix it, if someone has that error, just uninstall and delete the folder, use ctrl+h if you can't find the folder in your documents, install the software again and should work again.

    Remember to save the scratches folder before erasing the pycharm folder.

    0 讨论(0)
  • 2020-11-28 10:18

    change PYTHONHOME to the parent folder of the bin file of python, like /usr,which is the parent folder of /usr/bin.

    0 讨论(0)
  • 2020-11-28 10:19

    If you made a virtual env, then deleted that python installation, you'll get the same error. Just rm -r your venv folder, then recreate it with a valid python location and do pip install -r requirements.txt and you'll be all set (assuming you got your requirements.txt right).

    0 讨论(0)
  • 2020-11-28 10:19

    Try export PYTHONHOME=/usr/local. Python should be installed in /usr/local on OS X.

    This answer has received a little more attention than I anticipated, I'll add a little bit more context.

    Normally, Python looks for its libraries in the paths prefix/lib and exec_prefix/lib, where prefix and exec_prefix are configuration options. If the PYTHONHOME environment variable is set, then the value of prefix and exec_prefix are inherited from it. If the PYTHONHOME environment variable is not set, then prefix and exec_prefix default to /usr/local (and I believe there are other ways to set prefix/exec_prefix as well, but I'm not totally familiar with them).

    Normally, when you receive the error message Could not find platform independent libraries <prefix>, the string <prefix> would be replaced with the actual value of prefix. However, if prefix has an empty value, then you get the rather cryptic messages posted in the question. One way to get an empty prefix would be to set PYTHONHOME to an empty string. More info about PYTHONHOME, prefix, and exec_prefix is available in the official docs.

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