我正在尝试使用import FormData from 'FormData';
import AsyncStorage from '@react-native-community/async-storage';
export default class Test {
constructor() {
this.state = {
infos: null,
userId: ''
};
}
componentDidMount() {
AsyncStorage.getItem(this.state.userId)
.then(userID => {
this.setState({ userId: userID || '' });
})
.then(() => {
return this.getScoreFromAPI();
})
.then(data => {
this.setState({ infos: data });
})
.catch(console.error);
}
getScoreFromAPI = () => {
const formData = new FormData();
formData.append('userId', this.state.userId);
formData.append('key', '***'); //my key
fetch('https://www.globalfidelio.com/gfn_arcol/api/transaction.php', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'multipart/form-data'
},
body: formData
})
.then(response => {
// use response data here
return response.json();
})
.catch(e => {
console.error(e);
return null;
});
};
}
评估一些聚类结果,但是在运行代码时出现以下异常:
ClusteringEvaluator
使用以下命令导入ImportError: cannot import name ClusteringEvaluator
:
ClusteringEvaluator
我已将我的Spark版本从2.2升级到2.4.3,并运行了from pyspark.ml.evaluation import ClusteringEvaluator
打印:
spark-submit --version
我想念什么吗?
更新:有趣的是,我可以在命令行中导入该程序包而不会出现问题,而只有pycharm可以得到该异常。