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

本站现有博文311篇,共被浏览740006

本站已经建立2376天!

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