Installing iPython: “ImportError cannot import name path”?

后端 未结 5 787
礼貌的吻别
礼貌的吻别 2021-02-06 22:31

I\'m trying to install IPython. I have run pip install ipython[notebook] without any errors, but now I get this:

$ ipython notebook
Traceback (most          


        
相关标签:
5条回答
  • 2021-02-06 22:52

    Use a capital "P" in "Path".

    0 讨论(0)
  • 2021-02-06 22:54

    Looks like this is a known issue, caused by a change in the path.py package. Reverting to an older version of path.py solves this :

    sudo pip3 install -I path.py==7.7.1
    
    0 讨论(0)
  • 2021-02-06 23:12

    I received this error while trying to import matplotlib on Windows 10. My problem was that matplotlib needed an update. I just ran the following code:

    python -m pip install matplotlib
    

    or:

    conda install matplotlib
    

    My guess is that this can be applied to IPython.

    0 讨论(0)
  • 2021-02-06 23:13

    I had similar issues and rolling back to an earlier version of path.py did not not help. I uninstalled the package and then IPython Notebook worked.

    pip uninstall -y path.py

    0 讨论(0)
  • 2021-02-06 23:15

    It appears that pickleshare is in package IPython.utils. Try tying

    from IPython.utils.pickleshare import PickleShareDB 
    

    Similarly, path is in IPython.external. Try typing

    from IPython.external.path import path as Path
    

    In either case, I would check if following files exist.

    "/Users/me/.virtualenvs/.venv/lib/python2.7/site-packages/IPython/utils/pickleshare.py"
    "/Users/me/.virtualenvs/.venv/lib/python2.7/site-packages/IPython/external/path/_path.py"
    

    All this points to the fact that probably your IPython/notebook version is old. A couple of solutions would be

    1) Try editing files in site-packages and changing import lines to

    from IPython.external.path import path as Path
    from IPython.utils.pickleshare import PickleShareDB
    

    But that's kind of risky, who knows what else might fail.

    Otherwise, try upgrading ipython/notebook

    pip install ipython --upgrade
    pip install "ipython[notebook]" --upgrade
    
    0 讨论(0)
提交回复
热议问题