简体   繁体   中英

Installing SIP for Python 2.7 on windows 10

I have seen many threads that have a high level of ambiguity and go off on tangents from the original question, often assuming much about the authors ability, so I am hoping that if I am direct and concise with my information, I will get an answer that is in line with the requirement. I know that the serious programmers will have seen this many times, in many formats, so please just bear with me as this is doing my head in. Please do not just post a link to some other answer as I rarely find that helps with my current issue.

I am not a hardcore programmer, I find the compiling, sourceball, tar, gz all nonsense to be honest and am looking for the easiest way to install sip for python on my machine. I have installed various versions of mingw32, mingw64 to the point that I don't know which one is best to use. I am assuming that the one here: C:\\Program Files\\mingw-w64 is the one, considering I am using 64 bit, but do the others I have installed impact on this?

I also installed versions of mysys: C:\\msys\\1.0, C:\\msys64, but I still m unclear what and why etc, despite trying to read the docs that came with them.

I have windows 10, 64 bit professional edition. I have python 2.7 I have installs of mingw, 32 bit and 64 bit in various locations, due mostly to not fully understanding what exactly it was or where it should go. I found zips of it and exes, so I got a bit confused.

I downloaded the sip package and unpacked it to here: C:\\Python27\\Lib\\site-packages\\sip-4.19.3 and it has the configure.py file in it. So far, so good.

I used a CMD window, changed directory to: C:\\Python27\\Lib\\site-packages\\sip-4.19.3 and then used the command: python configure.py to create the Makefile file which is what I believe is supposed to happen.

I then opened the mingw64 shell, changed directory to the above sip folder and typed: python configure.py again, just to be sure I would get a response and create the files again, probably should not have done so, but hey ho, at this point, I am quite frustrated with it and trying to do anything with what I have, which I know is poor practice. (see image 1.) image 1: configure.py executed

From what I have read, I should use the make function that comes with Mingw64, but I tried the following, which also includes the configure.py code, but nothing seems to work when trying to use the Makefile file that was created via the configure.py process.

c:\Python27>cd ./Lib/site-packages/sip-4.19.3

c:\Python27\Lib\site-packages\sip-4.19.3> python configure.py
This is SIP 4.19.3 for Python 2.7.13 on win32.
The SIP code generator will be installed in C:\Python27.
The sip module will be installed in C:\Python27\Lib\site-packages.
The sip.pyi stub file will be installed in C:\Python27\Lib\site-packages.
The sip.h header file will be installed in C:\Python27\include.
The default directory to install .sip files in is C:\Python27\sip.
Creating siplib\sip.h...
Creating siplib\siplib.c...
Creating siplib\siplib.sbf...
Creating sipconfig.py...
Creating top level Makefile...
Creating sip code generator Makefile...
Creating sip module Makefile...

c:\Python27\Lib\site-packages\sip-4.19.3> Makefile
'Makefile' is not recognized as an internal or external command,
operable program or batch file.

c:\Python27\Lib\site-packages\sip-4.19.3> make Makefile
make: Nothing to be done for `Makefile'.

c:\Python27\Lib\site-packages\sip-4.19.3> Makefile Makefile
'Makefile' is not recognized as an internal or external command,
operable program or batch file.

c:\Python27\Lib\site-packages\sip-4.19.3>

So now I am at an impasse. I have the locations of my mingw versions and the msys in my path environment variable and I have done just about everything I have looked at on the web. I realise that its an order of things, but I really wish there were just executables for these modules and supporting tools as this compiling is a ball ache.I tried opening a python shell and importing sip.

>>> import os, sys
>>> import sip

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    import sip
ImportError: No module named sip
>>> import sipconfig    

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    import sipconfig
ImportError: No module named sipconfig
>>> from sip import sip

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    from sip import sip
ImportError: No module named sip
>>> from sipconfig impport sip
SyntaxError: invalid syntax
>>> from sip import *

Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    from sip import *
ImportError: No module named sip

So, if anyone has read through this and has a definitive answer as to what I am doing wrong, I would appreciate it.

make/nmake or make/nmake install cant be done from cmd and python path; instead using mingw or visual studio tools.

In windows search for prompt or Visual studio tools to open VS Command promt and from there cd--> sip file location (before this run configure.py present in sip folder)

Now run the commands nmake and then nmake install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM