问题描述
我想使用PIP软件包管理器安装PySide.但是它收到此错误消息,提示未找到nmake.这并不奇怪,因为我没有安装MSVC,也没有打算这样做.
I want to install PySide using PIP package manager. But it get this error message saying it didn't find nmake. This is no surprise because I do not have MSVC installed nor do I intend to.
Installing collected packages: pyside
Running setup.py install for pyside
Removing c:\users\cnyffele\appdata\local\temp\pip_build_cnyffele\pyside\pyside_package
Python architecture is 32bit
nmake not found. Trying to initialize the MSVC env...
Searching MSVC compiler version 9.0
error: Failed to find the MSVC compiler version 9.0 on your system.
但是setup.py程序可以简单地运行make:
However the setup.py program could simply run make:
C:\Users\cnyffele>where make
C:\MinGW32-xy\bin\make.exe
C:\Users\cnyffele>where mingw32-make
C:\MinGW32-xy\bin\mingw32-make.exe
但是出于某种原因,它坚持认为如果平台为"win32",则应使用msvc而不进行其他尝试.但是,它确实接受命令行选项:我可以将"make-spec"指定为"mingw"(请参见下文).
But for some reason, it insists that if the platform is "win32" it should use msvc without trying anything else. It does, however, accept command-line options: I could specify "make-spec" to be "mingw" (see below).
来自 https://github.com/PySide/pyside-setup /blob/master/setup.py
OPTION_MAKESPEC = option_value("make-spec")
...
if sys.platform == "win32":
if OPTION_MAKESPEC is None:
OPTION_MAKESPEC = "msvc"
if not OPTION_MAKESPEC in ["msvc", "mingw"]:
print("Invalid option --make-spec. Available values are %s" % (["msvc", "mingw"]))
sys.exit(1)
在通过PIP安装时,如何使setyp.py使用正确的品牌?有没有办法让PIP在运行setup.py时提供命令行选项?如果不可能,请在PIP下载后如何手动运行setup.py?
How can I make setyp.py use the correct make when installing with PIP? Is there a way to have PIP provide command-line options to setup.py when it runs it? If this is not possible, how can I run setup.py manually after PIP downloaded it?
推荐答案
PIP允许通过选项来传递选项,如.
PIP allows passing options to setup via the options '--global-option' and '--install-option' as described in the pip reference guide.
解决方案是:
pip install --global-option="--make-spec=mingw" PySide
一些其他信息:
- 在使用pip安装PySide之前,必须先安装 cmake 和 Qt 4.8 .
- 构建错误使我无法直接通过pip下载和安装PySide.我需要从 pypi.python.org 下载车轮二进制软件包.
- That prior to installing PySide using pip, you have to install cmake and Qt 4.8.
- Build errors prevented me from downloading and installing PySide directly via pip. I needed to download the wheel binary packages from pypi.python.org.
使用预下载的.whl软件包,并假设该软件包位于当前工作目录中:
Using a pre-downloaded .whl package, assuming the package is located in the current working directory:
pip install --global-option="--make-spec=mingw" PySide-1.2.4-cp27-none-win32.whl
这篇关于使用PIP安装pyside-找不到nmake的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!