0

我知道这个问题已经被问了几十次了,但我仍然找不到我的答案。

有人告诉我 NumPy 应该预装在 OS X 的 python 2.7 上。为了检查,有人告诉我在终端的命令行中输入“import numpy”。没有出现错误,说明安装正确。然后我执行“import matplotlib.pyplot as plot”,我被告知该模块不存在。

现在,从终端移到 Eclipse,我在脚本中键入相同的命令,但两个包都不起作用。

我将 PyDev 2.8.2 用于 Eclipse 2.0.1 和 Python 2.7。我还通过键入“which python”检查了我使用的是 Python 2.7,我可以确认这一点,因为打印命令不需要 ()。但是,我确实曾经安装过 Python 3。

谢谢!

4

1 回答 1

1

Here's what I'd suggest:

1) Uninstall all other versions of python apart from the OS X system one. Make sure that none are left on your path with which python which should point to the OS X one.

2) Install brew, which is a package manager for OS X.

3) Use brew to install python - brew install python

4) Read up on brew's support of python here, it's pretty nice.

5) Use pip to install python packages, e.g pip install numpy matplotlib

6) If one of the packages needs a compiler you can install gcc with the brew formula apple-gcc42 or clang with llvm

7) Perhaps try out the new community edition of PyCharm

于 2013-10-05T17:17:52.897 回答