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

本站现有博文320篇,共被浏览757318

本站已经建立2422天!

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