python - 为 scikit-learn 安装轮子时的弃用警告
问题描述
我是 Python 新手。有人可以告诉我应该如何解决这个错误。
C:\Users\admin\Desktop\Hiwi\Python Programs>py TSP.py
C:\Users\admin\AppData\Local\Programs\Python\Python38-32\lib\site-packages\sklearn\externals\six.py:28: DeprecationWarning: The module is deprecated in version 0.21 and will be removed in version 0.23 since we've dropped support for Python 2.7. Please rely on the official version of six (https://pypi.org/project/six/).
warnings.warn("The module is deprecated in version 0.21 and will be removed "
Traceback (most recent call last):
File "TSP.py", line 4, in <module>
fitness_coords = mlrose.TravellingSales(coords=coords_lists)
NameError: name 'coords_lists' is not defined
先感谢您。
解决方案
首先,这不仅仅是一个错误warning
。接下来,看来py TSP.py
您实际上是在尝试运行 python 脚本。
在第 4 行中,之前fitness_coords = mlrose.TravellingSales(coords=coords_lists)
似乎coords_lists
没有定义。
你想运行这个???
然后你需要在TSP.py
文件中有这样的东西:
# Create list of city coordinates
coords_list = [(1, 1), (4, 2), (5, 2), (6, 4), (4, 4), (3, 6), (1, 5), (2, 3)]
# Initialize fitness function object using coords_list
fitness_coords = mlrose.TravellingSales(coords = coords_list)
对于警告,请在.py文件中使用:
import something
def warn(*args, **kwargs):
pass
import warnings
warnings.warn = warn
推荐阅读
- cmake - 如何知道 add_custom_command 的 post_build 风格是否成功?
- c++ - 如何将 Varadic 模板化为模板中的返回类型?
- swift - 修改控制器每秒将一些数据写入日志文件
- php - Wordpress - 仅在使用标签时在更多标签之前显示内容
- java - 如何根据 Processing3 中的鼠标位置更改 RGB 颜色?
- arrays - 在 Groovy 中有一种方法可以遍历数组并找到字符串的特定部分并将字符串的整个部分存储在另一个变量中
- ios - 在 SwiftUI 中的视图之间切换
- c++ - 仅当我在运行时不使用 sudo 时,某个程序才有效
- c# - 使输入框只接受英文字母、数字和符号
- github - 如何在 github 中显示来自 azure devops 的单元测试结果