Using Python and Streamlit with MS SQL

Table of Contents Create and activate the Python environment Install Python modules Install MS SQL Start coding & Run Prerequisites For this project, we used MS SQL, so the operating system is Windows Server 2012. I installed MS SQL Server 2012 Advanced. If your system is Windows 10 or Windows 11, install the latest version of MS SQL Express instead. Python 3.12 Windows OS MS SQL Express Internet Get started Create and activate the Python environment # Create the virtual environment python -m venv c:\project\event # Activate it cd c:\project\event\Scripts .\activate # Deactivate it when finished deactivateInstall Python modules You can install these modules step by step, or use pip install -r requirement.txt. ...

Install Jupyter notebook on Ubuntu 24.04 and allow remote access.

References: Vultr How to Install Jupyter Notebook on Ubuntu 24.04 https://docs.vultr.com/how-to-install-jupyter-notebook-on-ubuntu-24-04 Prerequisites Ubuntu 24.04 Internet access Install Jupyter Notebook with pip Update the APT package index: sudo apt update Install the virtualenv package: sudo apt install python3-virtualenv -y Create a virtual environment: virtualenv jupyter_env Activate the virtual environment: source jupyter_env/bin/activate Install Jupyter Notebook: pip install jupyter Verify the installed version: jupyter-notebook --version You can deactivate the virtual environment at any time by running deactivate. ...

Deep Live cam 笔记

Deep Live cam 笔记 项目地址: https://github.com/hacksider/Deep-Live-Cam 在本篇笔记中不会涉及cuda,Python,Conda,Git,等相关的计算机知识。只有步骤记录和在使用部署时遇到的问题记录。 以下操作都是在Windows操作系统下进行的,我的系统版本号为: Microsoft Windows 11 Pro 10.0.22631 Build 22631 先决条件 带有Nvidia 显卡的桌面电脑或者笔记本电脑 稳定的网络环境 DeepLiveCam所需的软件或编译工具 Python 3.10.0 CUDA cuDNN Git ffmpeg Conda-Py 3.10 Microsoft C++ Build Tools DeepLiveCam项目本体 模型下载 GFPGANv1.4 inswapper_128_fp16.onnx 环境安装 Python 3.10.0 下载地址: https://www.python.org/ftp/python/3.10.0/python-3.10.0-amd64.exe 像正常安装应用软件那样安装即可,记得勾选添加到系统变量 CUDA 下载地址: https://developer.nvidia.com/cuda-toolkit-archive 安装完成之后在命令行运行 nvidia-smi 检查显卡支持的最大CUDA 版本 nvidia-smi cuDNN 需要下载CUDA支持的版本 下载地址: http://developer.nvidia.com/rdp/cudnn-archive 安装完成之后在命令行运行 nvcc -V cuDNN的版本号 如果提示命令不存在,请检查系统的环境变量和用户变量 nvcc -V Git 下载地址: https://git-scm.com/downloads 安装完成之后在命令行运行 git --version 检查Git的版本号 git --version如果提示命令不存在,请检查系统的环境变量和用户变量 Conda 下载地址: https://docs.anaconda.com/miniconda/ 选择Miniconda3-py310_24.7.1-0-Windows-x86_64.exe ...

Python 批量查询快递单号,并将查询结果填入Excel中

缘由 因为11月份是快递量比较大时候,会有有很多快递单需要查询快递状态;之前是因为单量少,每一个单每一个单去baidu 直接看百度查询到的结果。这两个月由于快递单特别多,于是就打算用Python 结合快递100的API 来查询快递状态 代码 快递100 API 实时查询状态 # coding = utf-8 import hashlib import json import requests class KuaiDi100: def __init__(self): self.key = '' # TODO 客户授权key self.customer = '' # TODO 查询公司编号 self.url = 'https://poll.kuaidi100.com/poll/query.do' # 请求地址 def track(self, com, num, phone, ship_from, ship_to): """ 物流轨迹实时查询 :param com: 查询的快递公司的编码,一律用小写字母 :param num: 查询的快递单号,单号的最大长度是32个字符 :param phone: 收件人或寄件人的手机号或固话(也可以填写后四位,如果是固话,请不要上传分机号) :param ship_from: 出发地城市,省-市-区,非必填,填了有助于提升签收状态的判断的准确率,请尽量提供 :param ship_to: 目的地城市,省-市-区,非必填,填了有助于提升签收状态的判断的准确率,且到达目的地后会加大监控频率,请尽量提供 :return: requests.Response.text """ param = { 'com': com, 'num': num, 'phone': phone, 'from': ship_from, 'to': ship_to, 'resultv2': '1', # 添加此字段表示开通行政区域解析功能。0:关闭(默认),1:开通行政区域解析功能,2:开通行政解析功能并且返回出发、目的及当前城市信息 'show': '0', # 返回数据格式。0:json(默认),1:xml,2:html,3:text 'order': 'desc' # 返回结果排序方式。desc:降序(默认),asc:升序 } param_str = json.dumps(param) # 转json字符串 # 签名加密, 用于验证身份, 按param + key + customer 的顺序进行MD5加密(注意加密后字符串要转大写), 不需要“+”号 temp_sign = param_str + self.key + self.customer md = hashlib.md5() md.update(temp_sign.encode()) sign = md.hexdigest().upper() request_data = {'customer': self.customer, 'param': param_str, 'sign': sign} return requests.post(self.url, request_data).text # 发送请求 result = KuaiDi100().track('yuantong', 'YT9693083639795', '', '广东省江门市', '广东省深圳市') print(result)接口文档 ...

Coding Practice. Use an IP Guide retrieve your ip information

Intuduction When we need to check some IP address information , do we have to open the browser, then type the googl domain and copy-paste the IP address? In this article . I’m goinG to use python with IP GUIDE to check ipaddres information .This much better before. Let’s started Install Python found what version can be match your OS , download it and installl . https://www.python.org/downloads/ Install requests library website: https://pypi.org/project/requests/ $ python -m pip install requests Code #import requests library import requests #get data from ip guide response = requests.get(f'https://ip.guide/').json() #function get_ip def get_ip(): return response["ip"] #function get_location def get_location(): location_data = { "Latitude":response["location"]["latitude"], "Longitude" : response["location"]["longitude"], "City": response["location"]["city"], "Country": response["location"]["country"] } return location_data #function get_network def get_network(): network_data = { "Cidr": response["network"]["cidr"], "Host Start" : response["network"]["hosts"]["start"], "Host end" : response["network"]["hosts"]["end"] } return network_data #dictionary variable network_data = get_network() location_data = get_location() ipaddress = get_ip() # output information print(f"Your internet IPaddress is :{ipaddress}\n and below is this IPaddress other informations\n") # for loop for key,value in network_data.items(): print(f"{key}: {value}") print(" \n") for key,value in location_data.items(): print(f"{key}: {value}") print(" \n")Refrence https://ip.guide/ ...

Using Python with the OpenWeather.org AP

Using Python with the OpenWeathermap.org API In these notes, we will explore how to utilize Python with a free weather API (Application Programming Interface) to retrieve the current weather for a specific city. What You Need to Install and Obtain Python and the ‘requests’ package Access to a Weather API Basic coding knowledge Install requests package $ python -m pip install requests #install package $ python -m pip show requests #display requests version ...

搜尋文章

輸入標題、分類或文章內容

開始輸入以搜尋文章