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

本站现有博文332篇,共被浏览875490

本站已经建立2583天!

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