2

通过终端中的“source activate graphlab”,我可以启动 graphlab。

我这样创建它:“conda create -n graphlab python=2.7 anaconda”,因为未经测试且不推荐将 virtualenv 与 Anaconda 一起使用(根据终端中的警告,我不知道是否真的是这种情况.)。

启动graphlab后,终端显示:

discarding /Users/username/anaconda/bin from PATH
prepending /Users/username/anaconda/envs/graphlab/bin to PATH

但是当我想在 Spider IDE 中导入 graphlab 时,它会显示以下错误:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/username/anaconda/lib/python3.4/site packages/spyderlib/widgets/externalshell/sitecustomize.py", line 580, in runfile
execfile(filename, namespace)
File "/Users/username/anaconda/lib/python3.4/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 48, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
File "/Users/username/Documents/projectname/pythonfile.py", line 3, in <module>
import graphlab as gl
ImportError: No module named 'graphlab'

我该如何解决这个问题?我对安装这些东西完全陌生,所以希望有人可以帮助我进行广泛的逐步解释。

4

5 回答 5

2

打开 Anaconda 命令提示符。运行以下命令:

pip install graphlab-create
于 2016-09-10T14:50:40.343 回答
2

Dato Graphlab Create 安装程序实际上并没有在我的 Mac (El Capitan) 上安装 graphlab。我在终端窗口中执行了以下操作(安装了 Anaconda):

% pip install graphlab-create

随后安装了 Graphlab Create。然后,您可以轻松验证:

% python
Python 2.7.10 |Continuum Analytics, Inc.| (default, Sep 15 2015, 14:29:08)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import graphlab
>>>

我注意到偶尔,Python 会忘记安装了 Graphlab Create。重复上述 'pip' 命令会使其记住。

于 2015-10-15T21:32:07.923 回答
1

Spider IDE 似乎默认配置为使用 Python3.4。那必须更改为2.7。这是来自有关问题的错误消息。

于 2015-03-23T18:02:16.073 回答
1

Spider IDE 似乎存在问题。

尝试从命令行解释器(Anaconda 版本)导入,它应该可以正常工作。

于 2015-03-25T18:05:26.583 回答
0

得到了相同的错误消息,尽管我肯定已经在 Windows 上使用 conda 的环境中安装了 GraphLab。我用不同环境的内核解决了这个问题。在命令行上执行以下操作:

激活 myenv

python -m ipykernel install --user --name myenv --display-name "Python (myenv)"

  • 将上面代码中的 myenv 替换为安装了 graphlab 的 (conda-) 环境的名称

来源(不同环境的内核):https ://ipython.readthedocs.org/en/stable/install/kernel_install.html

哦,为了确保您实际上已经在您的环境中正确安装了 graphlab,您可以通过在命令行中执行此操作来测试:

改变环境:

激活环境名称

启动 Python:

Python

如果找到 GraphLab,请检查 Python:

导入图形实验室

(如果您没有收到错误消息,那么您确实在该特定环境中正确安装了 graphlab)

于 2016-02-08T12:28:41.113 回答