No module named yaml (brew broke my python, again)

后端 未结 2 1755
Happy的楠姐
Happy的楠姐 2021-01-24 06:59

homebrew has again broken python for about third time. Im now having issues getting dependencies to work again. At this point I am unable to install yaml

2条回答
  •  执念已碎
    2021-01-24 07:23

    The solution for me turned out to be homebrew changing python to python2, which I believe precludes using the brew version instead of the system version

    eg python script.py >> python2 script.py

    Additionally, linking the system version of python to the brew python2 version helped as well:

    cd /usr/local/bin && ln -s ../Cellar/python/2.7.13_1/bin/python2 python

    I'm also hesitant the accepted answer will work, as pyaml is still attempting to import yaml, via __init__.py; which does not exist even after installing both packages

    $ pip install pyaml 
    Collecting pyaml
      Using cached pyaml-17.7.2-py2.py3-none-any.whl
    Requirement already satisfied: PyYAML in ~/Library/Python/2.7/lib/python/site-packages (from pyaml)
    Installing collected packages: pyaml
    Successfully installed pyaml-17.7.2
    $ pip install yaml 
    Collecting yaml
      Could not find a version that satisfies the requirement yaml (from versions: )
    No matching distribution found for yaml
    

    eg

      File "/~/virtualenv/project/lib/python2.7/site-packages/pyaml/__init__.py", line 6, in 
        import os, sys, io, yaml
    

提交回复
热议问题