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

本站现有博文340篇,共被浏览1017844次

本站已经建立2718天!

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