Python:安装SIP [英] Python: Install sip

查看:498
本文介绍了Python:安装SIP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据Windows 7计算机上的文档安装python模块sip(版本4.17):

I wanted to install the python module sip (version 4.17) according to the documentation on my Windows 7 machine:

  • 按照文档
  • 将存储库解压缩到文件夹C:\Python27\Lib\site-packages\sip-4.17
  • 在此文件夹中使用命令python.exe configure.py配置软件包
  • 构建模块mingw32-make失败.
  • Download from the official page as described in the documentation
  • Unzip the repository to the folder C:\Python27\Lib\site-packages\sip-4.17
  • Configure the package with the command python.exe configure.py in this folder
  • Building the module mingw32-make fails.

Mingw的make返回以下错误消息:

Mingw's make returns the following error message:

mingw32-make[1]: Entering directory 'C:/Python27/Lib/site-packages/sip-4.17/sipgen'
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o main.o main.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o transform.o transform.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o gencode.o gencode.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o extracts.o extracts.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o export.o export.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o heap.o heap.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o parser.o parser.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o lexer.o lexer.c
g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-subsystem,console -Wl,-s -o sip.exe main.o transform.o gencode.o extracts.o export.o heap.o parser.o lexer.o
mingw32-make[1]: Leaving directory 'C:/Python27/Lib/site-packages/sip-4.17/sipgen'
mingw32-make[1]: Entering directory 'C:/Python27/Lib/site-packages/sip-4.17/siplib'
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o siplib.o siplib.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o apiversions.o apiversions.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o descriptors.o descriptors.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o qtlib.o qtlib.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o threads.o threads.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o objmap.o objmap.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o voidptr.o voidptr.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o array.o array.c
g++ -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o bool.o bool.cpp
g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -shared -Wl,-subsystem,console -Wl,-s -o sip.pyd siplib.o apiversions.o descriptors.o qtlib.o threads.o objmap.o voidptr.o array.o bool.o -LC:\Python27\libs -lpython27
C:\Python27\libs/libpython27.a: error adding symbols: File format not recognized

collect2.exe: error: ld returned 1 exit status
Makefile:36: recipe for target 'sip.pyd' failed
mingw32-make[1]: *** [sip.pyd] Error 1
mingw32-make[1]: Leaving directory 'C:/Python27/Lib/site-packages/sip-4.17/siplib'
Makefile:3: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

我不知道为什么它无法编译File format not recognized的代码.是否与 g ++输出中的错误相同:无法识别文件:无法识别文件格式? 谢谢您的提前帮助!

I have no clue why it failed to compile the code saying File format not recognized. Is it the same mistake as in g++ output: file not recognized: File format not recognized? Thank you for your help in advance!

我也遵循以下问题,但是我想使用zip文件安装它-这样我就知道安装了什么.

I followed the following questions too but I want to install it using the zip file - so I know what is installed.

  • Can't configure pyQt
  • How to install SIP & PyQT on windows 7

推荐答案

您如何配置SIP?您需要选择一个配置选项(请参阅SIP存档的docs文件中的文档).选择--platform win32-g ++后,我就可以使用它.

How did you configure SIP? You need to choose a configuration option (see documentation in the docs file of the SIP archive). I got this to work once I chose --platform win32-g++.

这篇关于Python:安装SIP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆