簡體   English   中英

如何修復“在Windows上將'Ipython'和'Jupyter Notebook'導入熊貓失敗”

[英]How to fix “Import Pandas inside 'Ipython' and 'Jupyter Notebook' fails on windows”

我的系統上安裝熊貓 ,但無法正常工作並發送錯誤ModuleNotFoundError:ipython中沒有名為“ pandas”的模塊。

當我嘗試在ipython中導入熊貓時收到錯誤消息:

    In [1]: import pandas
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-38d4b0363d82> in <module>
----> 1 import pandas

ModuleNotFoundError: No module named 'pandas'

當我嘗試在jupyter筆記本中導入熊貓時收到錯誤消息:

--------------------------------------------------------------------------

-
OSError                                   Traceback (most recent call last)
<ipython-input-1-38d4b0363d82> in <module>
----> 1 import pandas

c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pandas\__init__.py in <module>
      9 for dependency in hard_dependencies:
     10     try:
---> 11         __import__(dependency)
     12     except ImportError as e:
     13         missing_dependencies.append("{0}: {1}".format(dependency, str(e)))

~\AppData\Roaming\Python\Python37\site-packages\numpy\__init__.py in <module>
    138 
    139     # Allow distributors to run custom init code
--> 140     from . import _distributor_init
    141 
    142     from . import core

~\AppData\Roaming\Python\Python37\site-packages\numpy\_distributor_init.py in <module>
     24                 # NOTE: would it change behavior to load ALL
     25                 # DLLs at this path vs. the name restriction?
---> 26                 WinDLL(os.path.abspath(filename))
     27                 DLL_filenames.append(filename)
     28     if len(DLL_filenames) > 1:

c:\users\user\appdata\local\programs\python\python37-32\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
    354 
    355         if handle is None:
--> 356             self._handle = _dlopen(self._name, mode)
    357         else:
    358             self._handle = handle

OSError: [WinError 193] %1 is not a valid Win32 application

我嘗試卸載並重新安裝熊貓,但是沒有運氣

在您的iPython Notebook中,您可以嘗試運行以下命令嗎?

!pip install pandas

然后重新啟動您的iPython Notebook內核?

您很可能已將熊貓安裝到其他虛擬環境中。

您是否嘗試使用其他解釋器運行代碼(例如Visual Studio Code)或從終端運行,有時解釋器的模塊目錄可能與使用pip的模塊安裝目錄不同。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM