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

本站现有博文321篇,共被浏览764725

本站已经建立2442天!

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