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

本站现有博文323篇,共被浏览795315

本站已经建立2493天!

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