chenjl1972 发表于 2021-1-9 11:58:56

如何安装coverage

决策树分析时
dtc=DTC(criterion='entropy') #使用信息熵作为划分标准,对决策树进行分类
dtc.fit(x,y) # 对决策树进行训练
dot_data = tree.export_graphviz(dtc)
# graph = pydotplus.graph_from_dot_data(dot_data)
graph = graphviz.Source(dot_data)
pic=plot_tree(dtc)
plt.savefig((r'C:\Users\chenj\Desktop\tree_visualization.png')

运行到最后一步plt.savefig((r'C:\Users\chenj\Desktop\tree_visualization.png'),显示错误为:

Coverage is not importable in this environment. Please install coverage.py to selected interpreter or enable 'Use bundled coverage' in Settings | Coverage
但是pycharm 或者直接在CMD 中 pip install coverage 但安装不上,提示错误为:ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/9c/7d/dc510d76ef49034d3c6c52a173e64c367c309cdf75fdb4872eaf122ada50/coverage-5.3.1-cp39-cp39-win_amd64.whl (Caused by NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001EAB315F0D0>: Failed to establish a new connection: getaddrinfo failed'))

suchocolate 发表于 2021-1-12 10:24:56

试试阿里源:
pip install coverage -i https://mirrors.aliyun.com/pypi/simple
页: [1]
查看完整版本: 如何安装coverage