7

一个智障安装了一天的python和graphlab的血泪史

 2 years ago
source link: https://www.cnblogs.com/smartweed/p/7210689.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

一个智障安装了一天的python和graphlab的血泪史

大概的过程是这样的:

先装了python3.6.1.,然后发现搞错了Σ(  ̄□ ̄||),是32 bit的,卸了重装python 3.6.1 (64bit)。

然后装easy_install、pip、ipython notebook。历经千辛万苦搞定了ipython notebook之后,

再去turi下载graphlab,发现这玩意要求python 2.7的环境。。。(╯°口°)╯(┴—┴

还能怎么办呢只有重新装python2.7 64bit,

然后直接按turi推荐的步骤,先安装anaconda,再装graphlab,

最后在ipython notebook里import graphlab。。。(╯°口°)╯(┴—┴

总结下遇到的一些问题。

1. 32bit和64bit的安装包。

进入python官网  https://www.python.org/downloads/windows/

可以看到如下一堆可下载的安装包。

框出来的这两个都是 32bit 的。

64bit的在哪呢,这里。

其他的安装python注意事项:

1.记得要勾添加到path这一项或者之后手动添加路径

2. install for all users。

2. 安装 easy install 时报错TypeError: chown() missing 1 required positional argument: 'numeric_owner'

下载ez_setup-0.9.tar压缩包,地址:https://pypi.python.org/pypi/pip

解压后cmd里到相应的目录下运行python ez_setup.py

然后就一直报错

TypeError: chown() missing 1 required positional argument: 'numeric_owner'

解决方法:

在stackoverflow里找到解决办法就是找到压缩包里ez_setup.py这个文件然后手动把

self.chown(tarinfo, dirpath)
chown(tarinfo, dirpath, '')

由于不知道怎么打开.py文件(就是这么菜),我是用记事本打开的orz

解决了orz

3.ipython notebook 安装

装pip。安装方法:https://pip.pypa.io/en/latest/installing.html

然后 cmd运行  pip install jupyter notebook

启动notebook :

在cmd运行 jupyter notebook,

然后再网址输localhost:8888,会弹出一个页面要你输token。

打开后界面大概是这样的

Ipython notebook里的文档在哪呢?

在notebook里右上New,拖下来点python 3, 弹出一个新的可以输入的窗口,然后输入

import os

print os.getcwd()

输出的就是ipython notebook 文件存的地址。

最后一点。。。应该不会有人和我一样在运行ipython notebook时把cmd关了吧(怕不是个智障)( ̄ε(# ̄) Σ 

4.Anaconda 安装时路径错误

装python2.7

由于turi推荐装anaconda最后一步就是IPython Notebook,

装好python 2.7之后就不管其他的了,直接按照turi的步骤来。

Turi推荐的步骤:

Option 1: Install into Anaconda Python Environment (recommended)

Step 1:下载 Anaconda2 v4.0.0

Step 2: 安装 Anaconda

安装进度条到最后开始各种报错QUQ

我已经不记得试过多少方法了_(:3」∠)_

最后一次安装时 以管理员身份运行 好像可以解决 _(:3」∠)_

Step 3: Create conda environment

安装成功后在cmd里运行

# Create a new conda environment with Python 2.7.x

conda create -n gl-env python=2.7 anaconda=4.0.0
# Activate the conda environment

activate gl-env

Step 4: Ensure pip version >= 7

# Ensure pip is updated to the latest version

conda install pip

conda update pip

Step 5: Install GraphLab Create

# Install your licensed copy of GraphLab Create

pip install --upgrade --no-cache-dir https://get.graphlab.com/GraphLab-Create/2.1/注册使用的邮箱/注册时给的产品密钥/GraphLab-Create-License.tar.gz

Step 4: Ensure installation of IPython and IPython Notebook

# Install or update IPython and IPython Notebook

conda install ipython-notebook

不知道为什么 Step 5: Install GraphLab Create 后面是 Step 4: Ensure installation of IPython and IPython Notebook  orz

全部成功安装之后打开ipython notebook

5.最后 import graphlab。。。心好累啊_(:3」∠)_

在ipython notebook 里新建,然后 import graphlab

又出问题了(/TДT)/

不过上面有提示,按步骤来。

按要求先修改了C:\Anaconda2\envs\gl-env\lib\site-packages\graphlab的写入权限

然后运行
graphlab.get_dependencies()
Downloading xz.之后就不动了,等了20分钟左右吧。
一堆报错。

然后我只能再打开记事本试图改程序(垂死挣扎)。。。

参考了博客:

http://blog.csdn.net/u013569000/article/details/53886656?locationNum=2&fps=1

简单来说问题原因是因为网络的问题下载包会多次失败,无法安装完整。

解决办法就是找到 get_dependencies() 的源码,然后直接从源码里得到下载网址,手动下载,然后把源码里的文件位置相应修改就可以了。

我试了下。

运行的程序是 C:\Anaconda2\envs\gl-env\Lib\site-packages\graphlab\dependencies.py ,打开,得到下载的网址。

(xzarchive_file, xzheaders) = urllib.urlretrieve('http://tukaani.org/xz/xz-5.2.1-windows.zip')
(dllarchive_file, dllheaders) = urllib.urlretrieve('http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gcc-libs-5.1.0-1-any.pkg.tar.xz')

下载了两个安装包,都放在E盘,然后改源码

33 #(xzarchive_file, xzheaders) = urllib.urlretrieve('http://tukaani.org/xz/xz-5.2.1-windows.zip') #注释掉    
34 xzarchive_file = 'E:\\xz-5.2.1-windows.zip'
35 #xzarchive_dir = tempfile.mkdtemp()#注释掉 
36 xzarchive_dir = 'E:\';
43 #(dllarchive_file, dllheaders) = urllib.urlretrieve('http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gcc-libs-5.1.0-1-any.pkg.tar.xz')
44 dllarchive_file = 'E:\\mingw-w64-x86_64-gcc-libs-5.1.0-1-any.pkg.tar.xz'
45 #dllarchive_dir = tempfile.mkdtemp()
46 dllarchive_dir = 'E:\'

搞定,运行

然后Σ(  ̄□ ̄||)

这是为什么啊(/TДT)/ 连文件读写都会报错了么(╯°口°)╯(┴—┴

换个地址试了下,把文件存在 E:\python_graphlab,修改源码

#(xzarchive_file, xzheaders) = urllib.urlretrieve('http://tukaani.org/xz/xz-5.2.1-windows.zip')
xzarchive_file = 'E:\python_graphlab\\xz-5.2.1-windows.zip'
#xzarchive_dir = tempfile.mkdtemp()
xzarchive_dir = 'E:\python_graphlab';
 #(dllarchive_file, dllheaders) = urllib.urlretrieve('http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gcc-libs-5.1.0-1-any.pkg.tar.xz')
dllarchive_file = 'E:\python_graphlab\\mingw-w64-x86_64-gcc-libs-5.1.0-1-any.pkg.tar.xz'
#dllarchive_dir = tempfile.mkdtemp()
dllarchive_dir = 'E:\python_graphlab'

然后…好了…

???某种玄学的神秘力量??


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK