推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
oldbird
V2EX  ›  Python

py27 编译 pyd 问题请教

  •  
  •   oldbird · Apr 21, 2020 · 2718 views
    This topic created in 2351 days ago, the information mentioned may be changed or developed.

    参照了这篇文章 http://yshblog.com/blog/117

    主要就是 1 、安装微软为 Python 提供了专用的编译器 Microsoft Visual C++ Compiler for Python 2.7 2 、修改 python 安装目录下 Lib\distutils\msvc9compiler.py 文件,找到 get_build_version 方法直接 return 9.0 ;然后再找到 find_vcvarsall 方法直接返回 vcvarsall.bat 的路径

    运行 python setup.py build_ext --inplace 后,总是提示

    running build_ext

    building 'test' extension

    gcc -mno-cygwin -mdll -O -Wall -IC:\Wpy\WPy27_32\python-2.7.13\include -IC:\Wpy\WPy27_32\python-2.7.13\PC -c test.c -o build\temp.win32-2.7\Release\test.o

    error: command 'gcc' failed: No such file or directory

    不知道哪里去找 gcc,必须要安装?

    3 replies  •  2020-04-22 12:26:50 +08:00
    ysc3839
        1
    ysc3839  
       Apr 22, 2020 via Android
    你是想学习编译流程本身,还是想编译出一个 pyd ?如果是后者的话建议直接使用 pybind11 。
    https://github.com/pybind/pybind11
    oldbird
        2
    oldbird  
    OP
       Apr 22, 2020 via Android
    就是想编译一个 pyd,看博客帖子好像不需要 gcc,只要安装微软支持库,不知道为什么报错
    SingeeKing
        3
    SingeeKing  
       Apr 22, 2020
    你确定是在 Microsoft Visual C++ Compiler for Python 2.7 2 环境内运行的吗,试试直接执行 gcc -v 有没有版本信息
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4968 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 07:45 · PVG 15:45 · LAX 00:45 · JFK 03:45
    ♥ Do have faith in what you're doing.