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

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

本站已经建立2608天!

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