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

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

本站已经建立2463天!

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