我正在导入熊猫,它继续抛出7条DEBUG消息。它正在JupyterLab和pythonanywhere中发生。当我注释掉熊猫导入时,它不会出现
我尝试使用以下方法将其静音:warnings.filterwarnings(“ ignore”),无济于事。 尝试“从大熊猫作为pd导入大熊猫”以尝试避免进一步的导入等。
from bs4 import BeautifulSoup
from oauth2client.service_account import ServiceAccountCredentials
from yahoo_oauth import OAuth2
from datetime import date, timedelta
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import gspread
import smtplib
import time
import pandas
[2019-06-04 10:01:56,097 DEBUG] [matplotlib.__init__.wrapper] $HOME=/home/
[2019-06-04 10:01:56,104 DEBUG] [matplotlib.__init__.wrapper] matplotlib data path /usr/local/lib/python2.7/dist-packages/matplotlib/mpl-data
[2019-06-04 10:01:56,111 DEBUG] [matplotlib.__init__.rc_params_from_file] loaded rc file /usr/local/lib/python2.7/dist-packages/matplotlib/mpl-data/matplotlibrc
[2019-06-04 10:01:56,126 DEBUG] [matplotlib.__init__.<module>] matplotlib version 2.2.2
[2019-06-04 10:01:56,126 DEBUG] [matplotlib.__init__.<module>] interactive is False
[2019-06-04 10:01:56,127 DEBUG] [matplotlib.__init__.<module>] platform is linux2
[2019-06-04 10:01:56,127 DEBUG] [matplotlib.__init__.<module>] loaded modules: ['requests.Cookie', 'pandas._libs.numpy',
...继续进行100多行
答案 0 :(得分:2)
尝试:
import logging
logging.basicConfig(level=logging.INFO)
import pandas
有关日志记录模块的更多信息,请参见https://docs.python.org/3/howto/logging.html#logging-basic-tutorial。似乎您正在导入的内容正在为您设置日志级别(或您自己设置)
答案 1 :(得分:0)
只需在行末添加;
:
from bs4 import BeautifulSoup;
from oauth2client.service_account import ServiceAccountCredentials;
from yahoo_oauth import OAuth2;
from datetime import date, timedelta;
from email.mime.multipart import MIMEMultipart;
from email.mime.text import MIMEText;
import gspread;
import smtplib;
import time;
import pandas;
不客气:)