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

本站现有博文324篇,共被浏览808981

本站已经建立2511天!

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