Comments (3)
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.
@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.
@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
- copy
bat
tosetup.py
, run cmd.exe, thencall build_pyd.bat
, it will generate a defult python module. - if want to sepcify python version, rum cmd.exe, then
call 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)
- Communicating between threads example HOT 1
- Typo Error - 1.2. Unpacking Elements from Iterables of Arbitrary Length
- typo in section 1.2 user_record
- issue of example1.py of chapter 8 HOT 1
- example2 error on running
- 10.11 Loading Modules from a Remote Machine Using Import hooks HOT 5
- Huge XML files HOT 2
- Naming a slice example
- License missing HOT 3
- chapter 12.7 how_to_create_a_thread_pool example1.py Error HOT 1
- Missing ignore_types arg when calling the method of flatten recursively
- Page 48 2.7,Typo in Regex
- what the function of "flag" in example2 how_to_determine_if_a_thread_has_started?
- Tt
- Typo/misname stderr filename in the launch a daemon process example
- Cookbook
- define an class to a decorator, how to understand this code, which is wraps(func)(self) without assignment
- Some examples don't work HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-cookbook.