为什么pip show告诉我我有numpy版本1.13.1,而Pandas认为我有numpy版本1.8.0rc1

2024-03-28 18:19:40 发布

您现在位置:Python中文网/ 问答频道 /正文

为什么pip show告诉我我有numpy版本1.13.1,而Pandas认为我有numpy版本1.8.0rc1

导入熊猫时出现以下错误。有人能告诉我怎么解决这个问题吗。在

  1. 进口熊猫

     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
       File "/Library/Python/2.7/site-packages/pandas/__init__.py", line 23, in <module>
         from pandas.compat.numpy import *
       File "/Library/Python/2.7/site-packages/pandas/compat/numpy/__init__.py", line 24, in <module>
         'this pandas version'.format(_np_version))
     ImportError: this version of pandas is incompatible with numpy < 1.9.0
     your numpy version is 1.8.0rc1.
     Please upgrade numpy to >= 1.9.0 to use this pandas version
    
  2. 这些是我机器上的numpy的详细信息

     pip show numpy 
     Name: numpy
     Version: 1.13.3
     Summary: NumPy: array processing for numbers, strings, records, and objects.
     Home-page: http://www.numpy.org
     Author: NumPy Developers
     Author-email: numpy-discussion@python.org
     License: BSD
     Location: /Library/Python/2.7/site-packages
    
  3. 这些是我机器上熊猫的细节

     Name: pandas
     Version: 0.21.1
     Summary: Powerful data structures for data analysis, time series,and statistics
     Home-page: http://pandas.pydata.org
     Author: The PyData Development Team
     Author-email: pydata@googlegroups.com
     License: BSD
     Location: /Library/Python/2.7/site-packages
     Requires: pytz, python-dateutil, numpy
    
  4. 我尝试过卸载和重新安装numpy

     sudo  pip uninstall numpy
     sudo  pip install numpy  
    
  5. 我已经检查过熊猫是否有任何依赖问题

     pip check pandas         
     No broken requirements found.
    
  6. 我试过取消和重新链接numpy

     brew unlink numpy        
     brew link numpy
    
     Linking /usr/local/Cellar/numpy/1.13.3... 
     Error: Could not symlink bin/f2py
     Target /usr/local/bin/f2py
     already exists. You may want to remove it:
       rm '/usr/local/bin/f2py'
    
     To force the link and overwrite all conflicting files:
       brew link --overwrite numpy
    
     To list all files that would be deleted:
       brew link --overwrite --dry-run numpy
    

Tags: pipinnumpypandasversionpackageslinelibrary
1条回答
网友
1楼 · 发布于 2024-03-28 18:19:40

在pythonrepl中(我使用ipython)

In [98]: import numpy as np

In [99]: np.__version__
Out[99]: '1.13.3'

In [100]: np.__file__
Out[100]: '/Users//anaconda/lib/python2.7/site-packages/numpy/__init__.pyc'

这会告诉你纽姆是从哪里来的,对熊猫来说就是这样

^{pr2}$

在终端窗口中输入echo $PATH

相关问题 更多 >