V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2020-04-21 22:54:22 +08:00 · 1670 次点击
    这是一个创建于 1437 天前的主题,其中的信息可能已经有所发展或是发生改变。

    参照了这篇文章 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 条回复    2020-04-22 12:26:50 +08:00
    ysc3839
        1
    ysc3839  
       2020-04-22 05:55:58 +08:00 via Android
    你是想学习编译流程本身,还是想编译出一个 pyd ?如果是后者的话建议直接使用 pybind11 。
    https://github.com/pybind/pybind11
    oldbird
        2
    oldbird  
    OP
       2020-04-22 07:01:45 +08:00 via Android
    就是想编译一个 pyd,看博客帖子好像不需要 gcc,只要安装微软支持库,不知道为什么报错
    SingeeKing
        3
    SingeeKing  
       2020-04-22 12:26:50 +08:00
    你确定是在 Microsoft Visual C++ Compiler for Python 2.7 2 环境内运行的吗,试试直接执行 gcc -v 有没有版本信息
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1186 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 23:07 · PVG 07:07 · LAX 16:07 · JFK 19:07
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.