How to install Python package from source on Windows

bartc bc at freeuk.com
Thu May 18 20:27:52 EDT 2017


On 18/05/2017 18:11, Steve D'Aprano wrote:
> On Thu, 18 May 2017 11:38 pm, bartc wrote:

> Seems a bit hypocritical, don't you think? Expecting people to go spelunking
> into your undocumented mystery language source code to work out how to
> build it from source, and then turning around and complaining that Python's
> build process:
>
> PCbuild\build.bat -e -d

I thought I'd try it.

1 hour 40 minutes later (including have to install 4.5GB of .NET) VS2015 
is installed, but it complains about missing Git. (I already have the 
sources and thought they would do.)

So, install Git, re-download a fresh CPython. But now:

svn.exe must be on your PATH.
Try TortoiseSVN (http://tortoisesvn.net/) and be sure to check the
command line tools option.

WTF is svn.exe? Anyway I install it, try again, same error. Then I 
notice 'check ommmand line tools option'; where? Install again. Now svn 
is in the path.

Jesus, it seems to work! It shows:

Fetching external libraries...
Fetching bzip2-1.0.6...
Fetching nasm-2.11.06...
Fetching openssl-1.0.2k...
Fetching sqlite-3.14.2.0...
Fetching tcl-core-8.6.6.0...
Fetching tk-8.6.6.0...
Fetching tix-8.4.3.6...
Fetching xz-5.2.2...
Finished.

But then:

The system cannot find the path specified.

c:\p\cpython>msbuild "c:\p\cpython\PCbuild\pcbuild.proj" /t:Build /m 
/nologo /v:m /p:Configuration=D
ebug /p:Platform=Win32 /p:IncludeExternals=true /p:IncludeSSL=true 
/p:IncludeTkinter=true /p:UseTest
Marker= /p:GIT="C:\Program Files\Git\cmd\git.exe"
'msbuild' is not recognized as an internal or external command,
operable program or batch file.

So I need msbuild. (This is getting more and more like the Tutti Frutti 
sketch in that Marx Bros film...)

Install MSBUILD. Start a new console. Type msbuild; nothing. In fact I 
can't find any trace of it. Eventually track it down to inside VS 
directories, but there are several versions. Set up a temporary path, 
but I get:

The system cannot find the path specified.

c:\p\cpython>msbuild "c:\p\cpython\PCbuild\pcbuild.proj" /t:Build /m 
/nologo /v:m /p:Configuration=D
ebug /p:Platform=Win32 /p:IncludeExternals=true /p:IncludeSSL=true 
/p:IncludeTkinter=true /p:UseTest
Marker= /p:GIT="C:\Program Files\Git\cmd\git.exe"
c:\program files (x86)\microsoft visual 
studio\2017\community\Common7\IDE\VC\VCTargets\Microsoft.Cp
p.Platform.targets(57,5): error MSB8020: The build tools for v140 
(Platform Toolset = 'v140') canno
t be found. To build using the v140 build tools, please install v140 
build tools.  Alternatively, y
ou may upgrade to the current Visual Studio tools by selecting the 
Project menu or right-click the
solution, and then selecting "Retarget solution". 
[c:\p\cpython\PCbuild\pythoncore.vcxproj]

OK, try a different version, outside VS this time (maybe I didn't need 
to install it as it was already there? Who knows). Now I get:

The system cannot find the path specified

c:\p\cpython>msbuild "c:\p\cpython\PCbuild\pcbuild.proj" /t:Build /m 
/nologo /v:m /p:Configuration=D
ebug /p:Platform=Win32 /p:IncludeExternals=true /p:IncludeSSL=true 
/p:IncludeTkinter=true /p:UseTest
Marker= /p:GIT="C:\Program Files\Git\cmd\git.exe"

c:\p\cpython\PCbuild\pythoncore.vcxproj(42,3): error MSB4019: The 
imported project "c:\Microsoft.Cpp.Default.props" was not found. Confirm 
that the path in the <Import> declaration is correct, and that the file 
exists on disk.

This is where I give up out I think (it's getting late too).

Disappointed, I was hoping to be proved wrong, but I'm not really 
surprised as this is completely typical of the problems with these 
over-elaborate over-engineered solutions to something that should be 
straightforward.

I only wasted 2 1/2 hours so not too bad. (My ISP won't pleased at my 
11-12GB download though!)

-- 
bartc





More information about the Python-list mailing list