Git Product home page Git Product logo

Comments (3)

dabeaz avatar dabeaz commented on September 26, 2024

It's not likely to work unless compiler options are exactly the same as how Python itself was compiled. What's the error message?

from python-cookbook.

Yensan avatar Yensan commented on September 26, 2024

@dabeaz
David, I think this is VC++ compiler's bug. Because if I delete all of the // line comment, or I just change it into /* block comments */, it can compiled.
Although, I think I should give the compilling command out for other.
Notice: this is just ONE command line, I break it into lines.

call ""C:/Program Files (x86)/Microsoft Visual C++ Build Tools/vcbuildtools.bat"", "X86",
"&&", "cd", "/d", "${workspaceRoot}", "&&", "cl", "/W4 /EHsc /Ox /GL /DNDEBUG /MT", "-IC:/Python3632/include",
"/Fd:debug/", "/Fo:debug/", "${file}", "/link", "/LIBPATH:C:/Python3632/libs /LIBPATH:C:/Python3632/PCbuild/win32",
"/out:debug/${fileBasenameNoExtension}.exe"

from python-cookbook.

Yensan avatar Yensan commented on September 26, 2024

@dabeaz
I want to ask a question, why you use distutils module but not setuptools module to generate setup.py ? Does any technical consideration?
And, if I use VC++ to develop *pyd to python64, it is very difficult to compile. Many guys in github and stackOverFlow asked these question. So I Wrote a *bat file to do these things.
usage: two manners to use. I name it build_pyd.bat

  1. copy bat to setup.py, run cmd.exe, then call build_pyd.bat, it will generate a defult python module.
  2. if want to sepcify python version, rum cmd.exe, thencall path/build_pyd.bat path/to/python.exe dir/of/setup.py /rootDir/of/project

@echo off && @Rem usage: in setup.py dir, "cmd.exe build_pyd" OR "cmd.exe build_pyd python_path setup.py_dir proj_rootdir"
@Rem if VC installed, VCbat="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
@Rem Microsoft Visual C++ Build Tools ONLY
set VCbat="C:\Program Files (x86)\Microsoft Visual C++ Build Tools\vcbuildtools.bat"
@Rem set python path, OR use python in PATH. then Check Python
if "%1"=="" (set python=python && python -V >nul 2>&1 || (^
echo Please setting PATH!!! && set /p DUMMY="Press ENTER key to exit." & exit /b 0)
) else (set python=%1 & %1 -V >nul 2>&1 || (echo Invalid python path!!! & exit /b 0))
@Rem set setup.py dir, OR use this bat file dir(bat and py in same dir)
if "%2"=="" ( set dir=%cd% ) else ( set dir=%2 )
@Rem set logpath, or just use this bat file path
if "%3"=="" ( set logfile=buildpyd_log.txt ) else ( set logfile="%3/buildpyd_log.txt")
@Rem get Python Version_info, and educe Win32 OR Win64
for /f "tokens=*" %%i in ('"%python%" -V -V') do set py_v=%%i
for /f "tokens=1-3 delims=/ " %%1 in ("%date%") do set day=%%1-%%2-%%3
echo %day% %time% %py_v% && echo %day% %time% %py_v% >> %logfile%
echo %py_v% | findstr "AMD64" >nul 2>&1 && set platform=amd64 || set platform=X86
@Rem setting MSVC ENV----------
echo +----- Set VC++ build ENV %platform% && echo +----- Set VC++ build ENV %platform% >> %logfile%
CALL %VCbat% %platform% >> %logfile% 2>&1
@Rem platform build------------
echo +----- build pyd && echo +----- build pyd >> %logfile%
cd /d %dir%
%python% setup.py build_ext --inplace >> %logfile%
echo +----- task done
echo ---------------------- task done -------------------------------- >> %logfile%
exit /b 0

from python-cookbook.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.