我尝试使用pandas,但是当我使用python解释器导入pandas时,我有以下错误消息:
>>> import pandas as pd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/pandas/__init__.py", line 42, in <module>
import pandas.core.config_init
File "/usr/lib/python3/dist-packages/pandas/core/config_init.py", line 17, in <module>
from pandas.core.format import detect_console_encoding
File "/usr/lib/python3/dist-packages/pandas/core/format.py", line 10, in <module>
from pandas.core.index import Index, MultiIndex, _ensure_index
File "/usr/lib/python3/dist-packages/pandas/core/index.py", line 31, in <module>
from pandas.io.common import PerformanceWarning
File "/usr/lib/python3/dist-packages/pandas/io/common.py", line 5, in <module>
import csv
File "/home/sebastien/Documents/visualStudio/Python3_ex/Depute/analysis/csv.py", line 11, in <module>
import seaborn as sns # Pimp my Matplotlib
File "/usr/lib/python3/dist-packages/seaborn/__init__.py", line 1, in <module>
from .rcmod import *
File "/usr/lib/python3/dist-packages/seaborn/rcmod.py", line 5, in <module>
from . import palettes
File "/usr/lib/python3/dist-packages/seaborn/palettes.py", line 14, in <module>
from .utils import desaturate, set_hls_values
File "/usr/lib/python3/dist-packages/seaborn/utils.py", line 14, in <module>
pandas_has_categoricals = LooseVersion(pd.__version__) >= "0.15"
AttributeError: module 'pandas' has no attribute '__version__'
启动脚本时遇到同样的问题。 我使用Linux Mint。 每个人都知道会发生什么?
非常感谢你,
的Sebastien
答案 0 :(得分:0)
我遇到了类似的问题并搜索了一段时间,这里是我的总结:
首先,您是否尝试过关闭和打开?听起来很愚蠢,但对我有用。
其他建议的解决方案:
pip uninstall pandas
在那之后
pip install pandas
根据您的版本,您也可以尝试:
pip install pandas==0.22
您的环境也可能有问题,在这种情况下,您可以尝试以下操作:
python -m pip list -v
要检查包裹的位置,请注意是否有重复项,这可能是原因。