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

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

本站已经建立2487天!

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