cannot import name 'logger' from 'baselines' (unknown location)
时间: 2023-07-28 10:10:29 浏览: 53
这个错误通常出现在使用了旧版本的Baselines库,而新版本中已经移除了logger模块。解决方法是要么升级Baselines库到最新版本,要么在代码中使用其他日志库,比如Python内置的logging模块。你可以尝试使用以下代码来代替原来的Baselines logger:
```
import logging
logger = logging.getLogger(__name__)
```
这段代码会创建一个名为`__name__`的logger对象,并将其赋值给`logger`变量。你可以使用`logger`对象来记录日志信息。
相关问题
cannot import name 'logger' from 'joblib' (unknown location)
This error occurs when the imported module 'joblib' doesn't have a function or class named 'logger'.
You can try the following steps to resolve the error:
1. Check if the module 'joblib' is correctly installed in your environment. You can install it using pip or conda, depending on your environment.
2. Check if you are importing the correct module. Sometimes, a typo in the module name can cause the error.
3. Check the joblib documentation to see if the 'logger' function or class is supported by the module. If not, you may need to find an alternative solution to your problem.
4. If you are still unable to resolve the issue, consider seeking help from the joblib community or posting a question on a relevant forum or Stack Overflow.
cannot import name 'logger' from 'joblib'
This error message usually appears when you try to import the logger module from the joblib package, but the logger module is not available in joblib. The logger module is actually part of the Python standard library and can be imported directly using the following code:
```
import logging
```
If you need to use the logger module in your joblib code, you can import it as follows:
```
from logging import getLogger
```
This will import the getLogger function from the logging module, which you can then use to create a logger object in your code.
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.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)