AttributeError:“属性”对象没有属性“ __name __”

时间:2019-05-21 09:38:06

标签: python-3.x jupyter-notebook data-science

当我在数据科学项目中导入大熊猫时,遇到了这种错误。有人知道是什么原因造成的吗?

我尝试重新安装pandas和python 我也尝试过滚轮

import numpy as np
import pandas as pd

AttributeError                           
Traceback (most recent call last)
<ipython-input-2-b231533e2331> in <module>
      1 import numpy as np
----> 2 import pandas as pd
      3 from imblearn.over_sampling import SMOTE
      4 from sklearn.model_selection import train_test_split
      5 from sklearn.neighbors import KNeighborsClassifier

AttributeError: 'property' object has no attribute '__name__'

1 个答案:

答案 0 :(得分:0)

“我已经获得了相同的解决方案。在同一个系统问题中可能是多个python版本安装问题,因此您需要为数据科学项目创建一个虚拟环境,现在要创建虚拟环境。”

1. install python 3.x 2. install pip 3. pip install virtualenv #for creating virtual environment 4. mkvirtualenv folder_name #command for creating virtual environment 5 pip install pandas # run this command in virtual environment directory

现在导入大熊猫就可以了。