2016-10-02 184 views
0

我想在Python 3中使用WinPy發行版運行numpy。我把#!python3放在腳本的頂部,因爲我被告知這是Winpy允許你在特定版本中運行的東西。如果我在shell(Eclipse中),它工作正常,但運行腳本,當我嘗試從控制檯運行它,我得到這個錯誤:在Python3中找不到Numpy

Traceback (most recent call last): 
File "C:\Users\Dax\workspace\Python3\TestofPython3.py", line 9, in <module> 
    import numpy 
ImportError: No module named 'numpy' 

如果我不把在那個的頂部該腳本,它運行numpy罰款,直到它'輸入()'。它可以在帶或不帶#!python3的shell中工作。

+0

你試過了嗎? \ scripts \ pip install numpy'? –

+2

聽起來你已經爲python 2安裝了numpy,但不是python 3.另外,python 2使用'raw_input()'而不是'input()'。 –

回答

0

「#!python3」是爲了幫助控制檯確定正確的python版本。但是,您需要確保路徑正確。不要把「#!python3」放在「#!/ usr/bin /」,然後是你的python版本,所以「python」或「python3」。

查看這篇文章以獲取更多信息。 Article on "#!" Scripts.