博文

目前显示的是 二月, 2023的博文

oracledb 链接数据库

import os import oracledb import sys import pandas as pd import numpy as np import janitor from sqlalchemy import create_engine,text oracledb.init_oracle_client () # engine = create_engine( # f'oracle+oracledb://lxf:lxfXXK2023@192.168.30.48:1521/?service_name=JZDB1') engine = create_engine ( f'oracle+oracledb://lxf:lxfXXK2023@' , connect_args = { "host" : '192.168.30.48' , "port" : 1521 , "service_name" : 'JZDB1' }) sqltxt= ''' select * from IPVSDB.config_ymxx ''' ymxx= ( pd.read_sql ( text ( sqltxt ) , con =engine.connect () ) .clean_names () )

天气爬虫

 import time import pandas as pd import numpy as np import requests from bs4 import BeautifulSoup headers = {     "User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" } year=['2011','2012','2013','2014','2015','2016','2017','2018','2019','2020','2021','2022'] mon=['01','02','03','04','05','06','07','08','09','10','11','12'] tian=pd.DataFrame(columns=['日期', '最高气温', '最低气温', '天气', '风向']) for y in year:     for m in mon:         response=requests.get(f"http://lishi.tianqi.com/pingliang/{y}{m}.html",headers=headers)         time.sleep(0.5)         content = response.text         soup = BeautifulSoup(content,'lxml')         divs = soup.find_all

oracledb thick mode

 import os import oracledb import sys import pandas as pd from sqlalchemy import create_engine from sqlalchemy import text #需要配置 Oracle Instant Client oracledb.init_oracle_client() params = oracledb.ConnectParams(host="111111111", port=1521, service_name="111111") conn = oracledb.connect(user="11111111111", password="1111111111111",params=params)

Could not load the Qt platform plugin "xcb"

  sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev

cx_Oracle 安装

一、conda install cx_Oracle 二、安装 Oracle Instant Client 1、下载了instantclient-basic-linux.x64-11.2.0.4.0.zip   mkdir -p /opt/oracle  cd /opt/oracle/  mv instantclient-basic-linux.x64-11.2.0.4.0.zip  /opt/oracle/  unzip instantclient-basic-linux.x64-11.2.0.4.0.zip 2、将Instant Client永久添加到运行时链接路径  sudo sh -c "echo /opt/oracle/instantclient_11_2  > /etc/ld.so.conf.d/oracle-instantclient.conf"  sudo  ldconfig