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

本站现有博文341篇,共被浏览1047799次

本站已经建立2729天!

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