Ipython打破:没有开始,说缺少'pathlib2'分布

时间:2016-05-18 12:14:55

标签: python-2.7 ipython

当我在终端中执行ipython时,我看到以下错误

aman@ebex-MacBookPro:~/ipython_work$ ipython                                                                                       
Traceback (most recent call last):                                                                                                 
  File "/usr/local/bin/ipython", line 5, in <module>                                                                               
    from pkg_resources import load_entry_point                                                                                     
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3141, in <module>                                  
    @_call_aside                                                                                                                   
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3127, in _call_aside                               
    f(*args, **kwargs)                                                                                                             
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3154, in _initialize_master_working_set            
    working_set = WorkingSet._build_master()                                                                                       
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 640, in _build_master                              
    ws.require(__requires__)                                                                                                       
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 941, in require                                    
    needed = self.resolve(parse_requirements(requirements))                                                                        
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 828, in resolve                                    
    raise DistributionNotFound(req, requirers)                                                                                     
pkg_resources.DistributionNotFound: The 'pathlib2' distribution was not found and is required by ipython   

就在此之前我跟着

 $ git clone --recursive https://github.com/ipython/ipython.git
 $ cd ipython
 $ pip install -e ".[notebook]"

从[如何自动保存ipython notebook]链接

http://stackoverflow.com/questions/21517296/how-to-autosave-ipython-notebook

我尝试使用apt-get卸载和安装,但它仍然无法正常运行并丢失分发错误。

我安装了pathlib2

sudo pip install pathlib2

但是在访问ipython时又是一次 我看到了另一个错误

pkg_resources.DistributionNotFound: The 'backports.shutil_get_terminal_size' distribution was not found and is required by ipython

4 个答案:

答案 0 :(得分:14)

您需要手动安装一些软件包,如下所示:

pip install pathlib2
pip install backports.shutil_get_terminal_size
pip install enum34

答案 1 :(得分:2)

对我来说,我也必须pip install enum34,但int32bit的回答是有效的。

pip install pathlib2 backports.shutil_get_terminal_size enum34

答案 2 :(得分:0)

当我执行ipython interminal时,我看到同样的错误。通过安装有关异常的库来解决问题。

答案 3 :(得分:0)

我从Anaconda“ Environments” 启动了Jupyter笔记本,并且打开了dos Windows,其中出现了所有有问题的启动包。

然后,我只需要在您的环境中逐个安装此窗口中缺少和提及的软件包。您可以根据需要多次重试同一过程。