【问题标题】:How to tell setup.py to use Visual Studio如何告诉 setup.py 使用 Visual Studio
【发布时间】:2012-03-26 21:10:29
【问题描述】:

我正在 Windows 上构建 Python 扩展模块。扩展模块是用 C++ 编写的。当我调用setup.py bdist 时,setup.py 使用 MinGW 编译 C++ 代码。有什么方法可以让 setup.py 改用 MSVS 2008?

(我为什么要这样做?这个issue是一个原因。)

【问题讨论】:

    标签: python setuptools


    【解决方案1】:
    setup.py build --compiler=msvc
    setup.py bdist_egg
    

    【讨论】:

    • 不,我收到错误消息“错误:无法识别选项 --compiler”。
    • python setup.py build --compiler=msvc(或build_ext)通常对我有用,但 YMMV。
    • 在“setup.py build --compiler=msvc”之后我只是运行“setup.py bdist”来创建分发包。对吗?
    • 如果安装了多个版本的 Visual Studio 怎么办(例如 VS2017、VS2019)。那我怎么能指定VS2017而不是VS2019呢?
    • @HaxtraZ,我也遇到了这个问题,我在2017 旁边安装了Visual studio 2010 并且知道我不知道如何使setup.py 使用2017 年。
    猜你喜欢
    • 2019-09-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-25
    • 2014-03-05
    • 1970-01-01
    • 2016-09-21
    • 2023-04-10
    相关资源
    最近更新 更多