EADST

Python: Compile .py to .so

1. Set up the environment

pip install cython
yum install python-devel (apt-get install python-devel)
yum install gcc (apt-get install gcc)

2. Create a setup.py file

from distutils.core import setup
from Cython.Build import cythonize

setup(ext_modules = cythonize(["your_file_name.py"]))

3. Run this line, the .so file saved in ./build/lib...

python setup.py build_ext

4. Move the .so file to main folder, then import the class or def.

import your_file_name
相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
Algorithm JSON Bipartite RL Linux Diagram 论文 SQL Transformers API Use PIP Pytorch Google BF16 第一性原理 Domain Card Paddle XGBoost Attention ResNet-50 Augmentation LoRA WebCrawler Sklearn Data Interview Ptyhon GIT Harness Firewall 公式 Vim 腾讯云 SPIE UNIX Template CV Baidu 论文速读 AI OpenAI Food Jetson 多进程 tqdm llama.cpp uwsgi Pandas LaTeX v0.dev CSV 搞笑 图形思考法 PyTorch NLTK RGB Crawler Jupyter Bitcoin Nginx scipy Zip COCO Jev Web Quantize Qwen2 Django Bert NameSilo 签证 Hilton 财报 CEIR ONNX 域名 Base64 API网关 VSCode VGG-16 QWEN VPN Streamlit hf SVR git ModelScope Animate Vmess GPT4 Image2Text Permission torchinfo GPTQ 报税 强化学习 Tensor Conda 多线程 递归学习法 Mixtral EXCEL TTS Quantization Gemma Pillow MD5 ChatGPT Disk Dataset 图标 LLAMA Color UI Datetime tar OpenCV Git SQLite Claude logger CAM PDF TensorRT 版权 Windows PDB Llama Land FP8 Agent Knowledge Pickle 净利润 Math CUDA PyCharm HaggingFace TensorFlow Hungarian Safetensors Rebuttal TSV C++ Video uWSGI Distillation Tracking Paper BeautifulSoup BTC Freesound Michelin Password LeetCode Github SAM Search GGML Proxy 阿里云 LLM YOLO CLAP Tiktoken Website FlashAttention GoogLeNet 证件照 NLP FP64 Ubuntu Cloudreve Excel Input Plate Python Clash icon 算法题 Shortcut Breakpoint Heatmap Qwen2.5 FP32 OCR 云服务器 音频 Docker 飞书 HuggingFace InvalidArgumentError FastAPI RAR Bin printf Magnet Anaconda Translation v2ray 继承 mmap Logo 顶会 transformers News 关于博主 Review Miniforge WAN Qwen CTC FP16 DeepStream Plotly Hotel Markdown DeepSeek Statistics XML Numpy CC git-lfs diffusers ms-swift IndexTTS2 Random
站点统计

本站现有博文338篇,共被浏览970743次

本站已经建立2682天!

热门文章
文章归档
回到顶部