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

本站现有博文328篇,共被浏览854814

本站已经建立2562天!

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