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

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

本站已经建立2463天!

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