因为需要,所以在自己的机器上使用GraphLab,但是出现了问题,如下:
- 当我在Jupyter中键入:
import graphlab
,并执行的时候报错:--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) <ipython-input-3-986a457431da> in <module>() ----> 1 import graphlab ModuleNotFoundError: No module named 'graphlab'
- 这是因为GraphLab目前支持的版本是2.x,而我的环境是3.x,故而报错找不到,解决方案:
- 创建一个2.7的虚拟环境,cmd环境下执行:
conda create -n python27 python=2.7
- 激活这个环境
activate python27
,否则报错:Could not find a version that satisfies the requirement graphlab-create>=2.1 (from GraphLab-Create-License==2.1) (from versions: ) No matching distribution found for graphlab-create>=2.1 (from GraphLab-Create-License==2.1)
- 创建一个2.7的虚拟环境,cmd环境下执行:
- 这是因为GraphLab目前支持的版本是2.x,而我的环境是3.x,故而报错找不到,解决方案:
- 在GraphLab官网注册,并通过邮件获取到
Product Key
执行下列命令安装GraphLab:pip install --upgrade --no-cache-dir https://get.graphlab.com/GraphLab-Create/<graphlab-version(当前2.1)>/<your-registered-email>/<your-product-key>/GraphLab-Create-License.tar.gz
- 安装过程如果出现报错:
Cannot uninstall 'certifi'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
,问题在于pip的版本问题,更新全局虚拟环境的pip版本:<Anaconda-Home>\envs\python27\python.exe -m pip install pip==9.0.1
; - 还有一个红色的报错,不过最后还是安装完成了,不用管:
DEPRECATION: Uninstalling a distutils installed project (certifi) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
; - 如果网络不好, 可以使用国内的pip源,就是在原有的安装命令最后添加
-i <pip-source> --trusted-host <pip-source-host>
,国内的pip源还是比较多的,整理了几个(右键复制链接),如下:阿里云pip源,中国科技大学pip源,豆瓣pip源,清华大学pip源, 中国科学技术大学pip源等;
- 安装过程如果出现报错:
- 在Anaconda中切换到
python27
,安装Jupyter notebook
,重启生效,运行Jupyter notebook
,写入代码import graphlab
,然后执行,结果报错:<pre style="box-sizing: border-box; overflow: auto; font-family: monospace; font-size: 14px; display: block; padding: 1px 0px; margin: 0px; line-height: inherit; word-break: break-all; word-wrap: break-word; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); border: 0px; border-radius: 0px; white-space: pre-wrap; vertical-align: baseline; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">ACTION REQUIRED: Dependencies libstdc++-6.dll and libgcc_s_seh-1.dll not found. 1\. Ensure user account has write permission to C:\Programs\Anaconda3\envs\python27\lib\site-packages\graphlab 2\. Run graphlab.get_dependencies() to download and install them. 3\. Restart Python and import graphlab again. By running the above function, you agree to the following licenses. * libstdc++: [https://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html](https://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html) * xz: [http://git.tukaani.org/?p=xz.git;a=blob;f=COPYING](http://git.tukaani.org/?p=xz.git;a=blob;f=COPYING)</pre>
- 在win上开启
C:\Programs\Anaconda3\envs\python27\lib\site-packages\graphlab
的所有权限; - 执行在JupyterNoteBook上执行
graphlab.get_dependencies()
,如果不成功,多试几次,我的浏览器上装了谷歌访问助手一直装不成功,禁用之后试了1次就成功了; - 重启,再次导入
import graphlab
就成功了
- 在win上开启
- 每次需要使用虚拟环境的时候,需要执行命令:
activate python27
,即在Anaconda中切换环境即可;