2016-10-02 186 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.