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

本站现有博文327篇,共被浏览833109

本站已经建立2538天!

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