TypeError: get_month_sales_by_id() takes 0 positional arguments but 1 was given
时间: 2024-06-05 19:06:50 浏览: 9
This error message means that you are calling a function called `get_month_sales_by_id()` with one argument, but the function definition does not expect any arguments.
To fix this error, you need to check the function definition and make sure that it accepts one argument. If it does not, you need to remove the argument when calling the function. Alternatively, if you need to pass an argument to the function, you need to modify the function definition to accept the argument.
相关问题
TypeError: get_current_value() takes 0 positional arguments but 1 was given什么意思
这个错误意味着你正在尝试调用 `get_current_value()` 方法,但是你给它传递了一个参数,而它实际上不需要任何参数。可能的原因是你在调用该方法时意外地传递了一个参数给它,或者你在定义该方法时意外地将它定义为接受一个参数。你需要检查一下代码,确保在调用该方法时没有传递任何参数,并且该方法的定义应该是不接受任何参数的。
TypeError: global_variables_initializer() takes 0 positional arguments but 1 was given
这个错误通常出现在使用 TensorFlow 1.x 版本时。在 TensorFlow 2.x 版本中,`tf.compat.v1.global_variables_initializer()` 已经被移除。因此,你需要从 `tf.compat.v1` 模块中导入 `global_variables_initializer` 函数,并直接调用即可,不需要传入任何参数。示例代码如下:
```
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior() # 禁用 TensorFlow 2.x 特性
# 定义一些变量
x = tf.Variable(1.0)
y = tf.Variable(2.0)
# 初始化所有变量
init_op = tf.global_variables_initializer()
# 运行初始化操作
with tf.Session() as sess:
sess.run(init_op)
```
如果你使用的是 TensorFlow 2.x 版本,则可以直接使用 `tf.compat.v1.disable_v2_behavior()` 函数来禁用 TensorFlow 2.x 特性,然后直接调用 `tf.global_variables_initializer()` 函数即可。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)