Python ImportError: no module named os

前端 未结 2 1820
我在风中等你
我在风中等你 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.

    0 讨论(0)
  • 2021-01-21 01:37

    Use Anaconda.

    https://store.continuum.io/cshop/anaconda/

    It has every Python package you could possibly think of - including matplotlib - it updates them all at once as well.

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