2016-08-02 149 views
1

我有一个使用.Net Core 1.0(C#)构建的网站,并将其部署到Azure WebApp(32位模式)。如何在Azure C#webapp上安装SciPy?

该应用程序使用一些Python脚本,我能够创建一个虚拟env(3.4.1)并成功安装numpy(1.11.0)与pip install numpy

我面临的问题是我无法安装SciPy。尝试pip install scipy由于我明白的编译器问题而失败。

接下来的尝试是为Windows下载Christoph Gohlke的Python扩展包(from here),将其复制到我的网络应用程序,并尝试运行'pip install scipy-0.18.0-cp34-cp34m-win32.whl',但没有成功。我得到的错误是:

scipy-0.18.0-cp34-cp34m-win32.whl is not a supported wheel on this platform. 
Storing debug log for failure in D:\home\pip\pip.log 

pip.log包含以下内容:

scipy-0.18.0-cp34-cp34m-win32.whl is not a supported wheel on this platform. 
Exception information: 
Traceback (most recent call last): 
    File "D:\home\site\wwwroot\env\lib\site-packages\pip\basecommand.py", line 122, in main 
    status = self.run(options, args) 
    File "D:\home\site\wwwroot\env\lib\site-packages\pip\commands\install.py", line 257, in run 
    InstallRequirement.from_line(name, None)) 
    File "D:\home\site\wwwroot\env\lib\site-packages\pip\req.py", line 167, in from_line 
    raise UnsupportedWheel("%s is not a supported wheel on this platform." % wheel.filename) 
pip.exceptions.UnsupportedWheel: scipy-0.18.0-cp34-cp34m-win32.whl is not a supported wheel on this platform. 

我试图创建一个requirement.txt文件为Troubleshooting - Package Installation规定。然而,由于它不是python应用程序,而是一个dotNet Core C#,它似乎并不在乎require.txt文件,在deploy.cmd文件中没有看到它。

+1

尝试先将pip升级到最新版本'python -m pip install --upgrade pip',然后安装numpy + mkl'python -m pip install numpy-1.11.1 + mkl-cp34-cp34m-win32.whl ',然后安装scipy'python -m pip install scipy-0.18.0-cp34-cp34m-win32.whl'。确保安装了[Microsoft Visual C++ 2010 Redistributable Package(x86)](https://www.microsoft.com/zh-cn/download/details.aspx?id=5555)。 – cgohlke

+0

@cgohlke按预期工作。不知道如何检查是否安装了VC++,但这些步骤已经工作,我现在可以使用scipy。如果你创建一个答案,我会接受它。 – mdeblois

回答

1

@mdeblois,你的理解是正确的,请看下面的官方说明。当运行在Azure上

一些包可能无法安装使用PIP。它可能只是该包在Python包索引中不可用。可能需要编译器(编译器在运行Azure App Service中的Web应用程序的计算机上不可用)。

对于这种情况,解决方案是,您可以参考官方教程的Troubleshooting - Package Installation部分以了解如何处理。

+0

我已经更新的问题,使之更明显的是,我不只是试试'PIP安装scipy'而且还试图用编译车轮窗口。添加requirements.txt似乎没有做任何事情,因为它似乎是python部署,而我的不是。它恰好使用了一些python脚本,但是它使用的是与C#一起使用的dotnet核心。 – mdeblois