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

本站现有博文333篇,共被浏览922183

本站已经建立2628天!

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