Python can't locate distutils_path on Mac OSX

前端 未结 5 884
慢半拍i
慢半拍i 2021-02-01 18:54

I\'ve been using virtualenv + pip for python development. I\'m not sure what happened, but suddenly whenever I try to run a command-line tool or import libraries, I get this er

5条回答
  •  广开言路
    2021-02-01 20:01

    > cd /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/
    > sudo touch __init__.py
    

    Out-of-the-box python on Lion comes without the python source - just the compiled pyc/pyo files. However virtualenv goes looking for the distutils source file just to confirm where it is. Turns out all we need to do it touch the file it's looking for into existence.

    Credits belong to "npdoty" and "Nat Goodspeed".

提交回复
热议问题