Python ImportError: no module named os

前端 未结 2 1821
我在风中等你
我在风中等你 2021-01-21 00:55

Trying to upgrade matplotlib as in this post, I ran

export PYTHONHOME=/usr/lib/python2.7/
sudo easy_install -U distribute
sudo pip install --upgrade matplotlib
<         


        
2条回答
  •  天涯浪人
    2021-01-21 01:24

    The issue was changing PYTHONHOME, which could not find any modules because I have python running out of a user directory /Users/alavin89/Library/Python/2.7/lib/python/site-packages. Check the python path by running echo $PYTHONPATH. The fix:

    unset PYTHONHOME
    sudo pip uninstall matplotlib
    pip uninstall matplotlib
    pip install --user matplotlib
    

    Note: running uninstall again w/o sudo is to double-check it worked properly.

提交回复
热议问题