导入sklearncannot import name 'logger' from 'joblib' (unknown location)
时间: 2023-10-05 09:07:41 浏览: 518
这个错误可能是由于joblib版本冲突导致的。尝试升级joblib版本或降级sklearn版本。
你可以通过以下命令升级joblib:
```python
pip install --upgrade joblib
```
如果这个命令没有解决问题,你可以尝试降级sklearn版本:
```python
pip install scikit-learn==0.21.3
```
如果以上方法都没有解决问题,你可以尝试重新安装sklearn和joblib:
```python
pip uninstall scikit-learn joblib
pip install scikit-learn joblib
```
相关问题
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 'baselines' (unknown location)
这个错误通常出现在使用了旧版本的Baselines库,而新版本中已经移除了logger模块。解决方法是要么升级Baselines库到最新版本,要么在代码中使用其他日志库,比如Python内置的logging模块。你可以尝试使用以下代码来代替原来的Baselines logger:
```
import logging
logger = logging.getLogger(__name__)
```
这段代码会创建一个名为`__name__`的logger对象,并将其赋值给`logger`变量。你可以使用`logger`对象来记录日志信息。
阅读全文