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

本站现有博文322篇,共被浏览791471

本站已经建立2487天!

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