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

本站现有博文333篇,共被浏览923932

本站已经建立2630天!

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