2016-08-02 145 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