How can I troubleshoot Python "Could not find platform independent libraries <prefix>"

Lars picture Lars · Oct 10, 2013 · Viewed 122.7k times · Source

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 not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site`

As a Python/Unix newbie I don't even know where to start trying to solve this. Can anyone offer any advice? What are <prefix> and <exec_prefix> referring to?

When I type python --version I get Python 2.7.1. And in the directory /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7, there is a big list of modules, and site.py is definitely in that folder. How can I get my computer to find the modules?

Answer

Peter Mitrano picture Peter Mitrano · Oct 17, 2016

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).