How to install Python package from source on Windows
bartc
bc at freeuk.com
Thu May 18 14:17:34 EDT 2017
On 18/05/2017 18:11, Steve D'Aprano wrote:
> On Thu, 18 May 2017 11:38 pm, bartc wrote:
>
>>> Speaking of user-hostile experiences, why do you need separate source
>>> files for 32- and 64-bit builds? Why isn't it just a build option?
>>>
>>> I've never heard of people using separate source code for 32- and 64-bit
>>> releases. I can understand pre-built binaries coming in two flavours,
>>> but that's a pretty hostile experience to have different source files
>>> for 32-bit. How do you keep them in sync?
>>
>> This is just a consequence of not using C language for the original
>> source.
>
> I'm not interested in excuses. A poor workman blames his tools, which is
> ironic considering that in this case you've built your own tools to your
> own specification.
>
> Don't you think its a bit hypocritical to be criticising Python's source
> code for being so complex given the complexity of your own build? You
> expect your users to READ THE SOURCE CODE to find out how to buid the code!
Are you being serious? IT'S ONE FRIGGING FILE!
If a project had 20,000 source files, then it might be an idea to put
instructions in a separate readme file rather than trying to find which
source file had them.
But this is a single file. And the instructions are extra to details
given elsewhere.
>
> [wall of text]
The wall of text consists of very long string constants that gcc is
displaying so it can tell you they are very long. (One or two compilers
can't handle them, but gcc can, so a routine that would normally divide
them into smaller ones has been disabled.)
> Holy mother of perl! Look at all those warnings! Uninitialised variables,
There is one uninitialised variable reported. And that is used only in
an error situation. But yes, that was a mistake.
> unsafe dereferencing of type-punned pointers, missing parentheses,
suggested parentheses not missing.
> unused variables and labels,
What about them? If I write this in Python for a function that isn't called:
def fn(a,b,c,d,e):
return
I get no warnings neither for the unused parameters nor for the function
itself. Why not?
What do you get with gcc -Wall on any Python module? Or does most of the
makefile consist of options to disable specific warnings?
(I'm genuinely interested as all I get are hundreds of errors. Obviously
they must be compiled in a special way, but I don't know how.)
> It builds, but the instructions were hard to find and unclear once I found
> them, the entire process was difficult and scary and gave me no confidence
> that your code is safe to run.
>
> Maybe it is, but I'm not brave enough to run it on my computer.
I'm sorry, I thought anyone who has used C a couple of times would know
how to compile a Hello, World program. And would know how to download a
file into a local directory. Here are some instructions to get started:
(1) Click on this link:
https://github.com/bartg/langs/blob/master/bccproj/hello.c
(2) Click the Raw option on the bar across the top of the text
(3) Select all and copy to clipboard (eg. ctrl-A followed by Ctrl-C on
my browser)
(4) Open your programming editor and paste into a new file; save it as
hello.c
(5) In the same directory where you put hello.c, now invoke your C compiler.
I can't help much with this step, you will need to find out how to run a
C compiler on your machine on a specific file.
But if the current directory is FRED, and the hello.c file is
FRED/hello.c, then it might typically look like this:
FRED> gcc hello.c
This now produces an executable (a.out or a.exe) [other compilers may
work differently]. You can run that as:
FRED> a # Windows
FRED> ./a.out # Linux
It should say:
Hello, World!
FRED>
If you've got this far, then congratulations! You've just managed to
download, compile and run the world's simplest C program.
Well, that qcc32.c source file can be downloaded and compiled in exactly
the same way:
FRED> gcc qcc32.c
FRED> ./a.out
Q Compiler 5.18
Usage:
qcc32 filename[.q]
qcc32 -help
FRED>
Well, almost:
1. If your compiler defaults to 64-bits, use -m32
2. To get a differently named executable from a.out, use -oqcc etc
3. If there is a link error, add -lm at the end (I don't know if gcc
still needs this)
(You don't really need -O3 for qcc32 as it will still be incredibly fast
without.)
--
bartc
More information about the Python-list
mailing list