2017-08-08 214 views
0

我使用Python3.6和熊貓閱讀CSV數據時遇到了問題。 一切都很好,工作的話,我也對我的拱門的系統更新安裝Python3.6熊貓「無法導入數據框」

sudo pacman -Syu 

然後試圖運行與進口我有以下錯誤大熊貓任何腳本時:

from .sqldf import * 
    File "/usr/lib/python3.6/site-packages/pandasql/sqldf.py", line 3, in <module> 
    from pandas.io.sql import to_sql, read_sql 
    File "/usr/lib/python3.6/site-packages/pandas/io/sql.py", line 23, in <module> 
    from pandas.core.api import DataFrame, Series 
    ImportError: cannot import name 'DataFrame' 

我得到這個錯誤有任何代碼導入大熊貓,如:

import pandas 
print ('Hello') 

因此,它與大熊貓的問題,但我似乎無法找到病因的根線上的任何位置。任何有關這個問題的幫助將不勝感激!

完全錯誤:

 from pandas import DataFrame 
    File "/usr/lib/python3.6/site-packages/pandas/__init__.py", line 42, in <module> 
    from pandas.core.api import * 
    File "/usr/lib/python3.6/site-packages/pandas/core/api.py", line 10, in <module> 
    from pandas.core.groupby import Grouper 
    File "/usr/lib/python3.6/site-packages/pandas/core/groupby.py", line 49, in <module> 
    from pandas.core.frame import DataFrame 
    File "/usr/lib/python3.6/site-packages/pandas/core/frame.py", line 67, in <module> 
    from pandas.core.generic import NDFrame, _shared_docs 
    File "/usr/lib/python3.6/site-packages/pandas/core/generic.py", line 49, in <module> 
    from pandas.io.formats.format import format_percentiles, DataFrameFormatter 
    File "/usr/lib/python3.6/site-packages/pandas/io/formats/format.py", line 35, in <module> 
    from pandas.io.common import (_get_handle, UnicodeWriter, _expand_user, 
    File "/usr/lib/python3.6/site-packages/pandas/io/common.py", line 4, in <module> 
    import csv 
    File "/home/knation/ML/dataScience/DataWrangling/csv.py", line 2, in <module> 
    import pandasql 
    File "/usr/lib/python3.6/site-packages/pandasql/__init__.py", line 1, in <module> 
    from .sqldf import * 
    File "/usr/lib/python3.6/site-packages/pandasql/sqldf.py", line 3, in <module> 
    from pandas.io.sql import to_sql, read_sql 
    File "/usr/lib/python3.6/site-packages/pandas/io/sql.py", line 23, in <module> 
    from pandas.core.api import DataFrame, Series 
ImportError: cannot import name 'DataFrame' 

這也可能是相關的,我最近吃豆子日誌,如果有這些變化可能造成該問題的任何想法?

[2017-08-08 10:38] [PACMAN] Running 'pacman -Syu' 
[2017-08-08 10:38] [PACMAN] synchronizing package lists 
[2017-08-08 10:38] [PACMAN] starting full system upgrade 
[2017-08-08 10:43] [ALPM] transaction started 
[2017-08-08 10:43] [ALPM] upgraded attr (2.4.47-2 -> 2.4.47-3) 
[2017-08-08 10:43] [ALPM] upgraded acl (2.2.52-3 -> 2.2.52-4) 
[2017-08-08 10:43] [ALPM] upgraded avr-binutils (2.28-1 -> 2.29-1) 
[2017-08-08 10:43] [ALPM] upgraded bridge-utils (1.6-1 -> 1.6-2) 
[2017-08-08 10:43] [ALPM] upgraded pango (1.40.7-1 -> 1.40.8-1) 
[2017-08-08 10:43] [ALPM] upgraded libxkbcommon (0.7.1-1 -> 0.7.2-1) 
[2017-08-08 10:43] [ALPM] upgraded gtk-update-icon-cache (3.22.17-1 -> 3.22.18-1) 
[2017-08-08 10:43] [ALPM] upgraded libsystemd (234.11-3 -> 234.11-4) 
[2017-08-08 10:43] [ALPM] upgraded gtk3 (3.22.17-1 -> 3.22.18-1) 
[2017-08-08 10:43] [ALPM] upgraded e2fsprogs (1.43.4-1 -> 1.43.5-1) 
[2017-08-08 10:43] [ALPM] upgraded systemd (234.11-3 -> 234.11-4) 
[2017-08-08 10:43] [ALPM] upgraded sqlite (3.19.3-1 -> 3.20.0-1) 
[2017-08-08 10:43] [ALPM] upgraded chromium (60.0.3112.78-1 -> 60.0.3112.90-1) 
[2017-08-08 10:43] [ALPM] upgraded ffmpeg (1:3.3.2-2 -> 1:3.3.3-1) 
[2017-08-08 10:43] [ALPM] upgraded firefox (54.0.1-1 -> 55.0-1) 
[2017-08-08 10:43] [ALPM] upgraded geoip-database (20170704-1 -> 20170801-1) 
[2017-08-08 10:43] [ALPM] upgraded perl-error (0.17024-2 -> 0.17025-1) 
[2017-08-08 10:43] [ALPM] upgraded git (2.13.3-2 -> 2.14.0-1) 
[2017-08-08 10:43] [ALPM] upgraded glew (2.0.0-1 -> 2.1.0-1) 
[2017-08-08 10:43] [ALPM] upgraded gnupg (2.1.21-3 -> 2.1.22-1) 
[2017-08-08 10:43] [ALPM] upgraded gparted (0.28.1-1 -> 0.28.1-2) 
[2017-08-08 10:43] [ALPM] upgraded linux (4.12.3-1 -> 4.12.4-1) 
[2017-08-08 10:43] [ALPM-SCRIPTLET] >>> Updating module dependencies. Please wait ... 
[2017-08-08 10:43] [ALPM] upgraded linux-headers (4.12.3-1 -> 4.12.4-1) 
[2017-08-08 10:43] [ALPM] upgraded linux-lts (4.9.40-1 -> 4.9.41-1) 
[2017-08-08 10:43] [ALPM-SCRIPTLET] >>> Updating module dependencies. Please wait ... 
[2017-08-08 10:43] [ALPM] upgraded linux-lts-headers (4.9.40-1 -> 4.9.41-1) 
[2017-08-08 10:43] [ALPM] upgraded python-prompt_toolkit (1.0.14-1 -> 1.0.15-1) 
[2017-08-08 10:43] [ALPM] upgraded s-nail (14.9.0-1 -> 14.9.3-1) 
[2017-08-08 10:43] [ALPM] upgraded systemd-sysvcompat (234.11-3 -> 234.11-4) 
[2017-08-08 10:43] [ALPM] upgraded vim-runtime (8.0.0722-1 -> 8.0.0851-1) 
[2017-08-08 10:43] [ALPM] upgraded vim (8.0.0722-1 -> 8.0.0851-1) 

注意:如果我在Python終端運行似乎沒有任何問題,只是劇本。

Shown is the import working in Python terminal but failing when ran in the simple script shown it errors out.

+0

這可能是一個愚蠢的問題,但爲什麼使用'從pandas.core.api導入DataFrame'而不是'從pandas導入DataFrame'? – RagingRoosevelt

+0

這是一旦我稱之爲「導入熊貓」,我的代碼就會出現在外面。 – ckdistancerunner

回答

0

因此,這是時間的極大浪費,似乎是錯誤什麼都沒有做,我用測試腳本。一旦我將它從目錄中移出,它的一切正常。