Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
d2l-zh
提交
a4c1f74e
D
d2l-zh
项目概览
OpenDocCN
/
d2l-zh
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
d2l-zh
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a4c1f74e
编写于
4月 03, 2018
作者:
A
Aston Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add appendix/install as MARKDOWN
上级
d2e50323
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
50 addition
and
62 deletion
+50
-62
Makefile
Makefile
+1
-1
chapter_appendix/install.md
chapter_appendix/install.md
+49
-61
未找到文件。
Makefile
浏览文件 @
a4c1f74e
...
...
@@ -8,7 +8,7 @@ build/%.md: %.md
@
mkdir
-p
$
(
@D
)
@
cp
$<
$@
MARKDOWN
=
$(
wildcard
*
/index
.md
)
MARKDOWN
=
$(
filter-out
chapter_preface/notation.md,
$(
wildcard
chapter_preface/
*
.md
*
/index.md
)
chapter_appendix/install
.md
)
NOTEBOOK
=
$(
filter-out
$(MARKDOWN)
,
$(
wildcard
chapter
*
/
*
.md
))
OBJ
=
$(
patsubst
%.md, build/%.md,
$(MARKDOWN)
)
\
...
...
chapter_appendix/install.md
浏览文件 @
a4c1f74e
...
...
@@ -9,8 +9,7 @@
例如Linux或者Mac OSX 10.11以上可以使用如下命令
```
bash
```
{.python .input}
mkdir gluon-tutorials && cd gluon-tutorials
curl https://zh.gluon.ai/gluon_tutorials_zh.tar.gz -o tutorials.tar.gz
tar -xzvf tutorials.tar.gz && rm tutorials.tar.gz
...
...
@@ -20,8 +19,7 @@ Windows用户可以用浏览器下载[zip格式](https://zh.gluon.ai/gluon_tutor
【可选项】配置下载源来使用国内镜像加速下载:
```
bash
```
{.python .input}
# 优先使用清华conda镜像
conda config --prepend channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
...
...
@@ -31,16 +29,14 @@ conda config --prepend channels http://mirrors.ustc.edu.cn/anaconda/pkgs/free/
然后安装所需的依赖包并激活环境:
```
bash
```
{.python .input}
conda env create -f environment.yml
source activate gluon # 注意Windows下不需要 source
```
之后运行下面命令,然后浏览器打开
[
http://localhost:8888
](
http://localhost:8888
)
(通常会自动打开)就可以查看和运行各个教程了。
```
bash
```
{.python .input}
jupyter notebook
```
...
...
@@ -61,8 +57,7 @@ jupyter notebook
### 通过docker安装
首先你需要下载并安装
[
docker
](
https://docs.docker.com/engine/installation/
)
。例如Linux下可以
```
bash
```
{.python .input}
wget -qO- https://get.docker.com/ | sh
sudo usermod -aG docker
# 然后logout一次
...
...
@@ -70,12 +65,12 @@ sudo usermod -aG docker
然后运行下面命令即可
```
bash
```
{.python .input}
docker run -p 8888:8888 muli/gluon-tutorials-zh
```
然后浏览器打开
[
http://localhost:8888
](
http://localhost:8888
)
,这时通常需要填docker运行时产生的token。
## 更新教程
目前我们仍然一直在快速更新教程,通常每周都会加入新的章节。同时MXNet的Gluon前端也在快速发展,因此我们推荐大家也做及时的更新。更新包括下载最新的教程,和更新对应的依赖(通常是升级MXNet)。
...
...
@@ -84,7 +79,7 @@ docker run -p 8888:8888 muli/gluon-tutorials-zh
先重新下载新的
[
zip
](
https://zh.gluon.ai/gluon_tutorials_zh.zip
)
或者
[
tar.gz
](
https://zh.gluon.ai/gluon_tutorials_zh.tar.gz
)
教程包。解压后,使用下面命令更新环境
```
bash
```
{.python .input}
conda env update -f environment.yml
```
...
...
@@ -92,27 +87,27 @@ conda env update -f environment.yml
直接下载新的docker image就行。
```
bash
```
{.python .input}
docker pull muli/gluon-tutorials-zh
```
### 使用Git
### 使用Git
更新
如果你熟悉git,那么直接pull并且之后merge冲突
```
bash
```
{.python .input}
git pull https://github.com/mli/gluon-tutorials-zh
```
如果不想merge冲突,那么可以在
`pull`
前用reset还原到上一个版本(记得保存有价值的本地修改)
```
bash
```
{.python .input}
git reset --hard
```
之后更新环境
```
bash
```
{.python .input}
conda env update -f environment.yml
```
...
...
@@ -120,7 +115,7 @@ conda env update -f environment.yml
这时候conda update可能不会自动升级GPU版本,因为默认是安装了CPU。这时候可以运行了
`source activate gluon`
后手动更新MXNet。例如如果安装了
`mxnet-cu80`
了,那么
```
bash
```
{.python .input}
pip install -U --pre mxnet-cu80
```
...
...
@@ -130,23 +125,20 @@ pip install -U --pre mxnet-cu80
默认安装的MXNet只支持CPU。有一些教程需要GPU来运行。假设电脑有N卡而且CUDA7.5或者8.0已经安装了,那么先卸载CPU版本
```
bash
```
{.python .input}
pip uninstall mxnet
```
然后选择安装下面版本之一:
```
bash
```
{.python .input}
pip install --pre mxnet-cu75 # CUDA 7.5
pip install --pre mxnet-cu80 # CUDA 8.0
```
【可选项】国内用户可使用豆瓣pypi镜像加速下载:
```
bash
```
{.python .input}
pip install --pre mxnet-cu75 -i https://pypi.douban.com/simple # CUDA 7.5
pip install --pre mxnet-cu80 -i https://pypi.douban.com/simple # CUDA 8.0
```
...
...
@@ -156,8 +148,7 @@ pip install --pre mxnet-cu80 -i https://pypi.douban.com/simple # CUDA 8.0
注意:这个只推荐给想上github提交改动的小伙伴。
我们源代码是用markdown格式来存储,而不是jupyter默认的ipynb格式。我们可以用notedown插件来读写markdown格式。下面命令下载源代码并且安装环境:
```
bash
```
{.python .input}
git clone https://github.com/mli/gluon-tutorials-zh
cd gluon-tutorials-zh
conda env create -f environment.yml
...
...
@@ -166,8 +157,7 @@ source activate gluon # Windows下不需要 source
然后安装notedown,运行Jupyter并加载notedown插件:
```
bash
```
{.python .input}
pip install https://github.com/mli/notedown/tarball/master
jupyter notebook --NotebookApp.contents_manager_class='notedown.NotedownContentsManager'
```
...
...
@@ -176,15 +166,13 @@ jupyter notebook --NotebookApp.contents_manager_class='notedown.NotedownContents
首先生成jupyter配置文件(如果已经生成过可以跳过)
```
bash
```
{.python .input}
jupyter notebook --generate-config
```
将下面这一行加入到生成的配置文件的末尾(Linux/macOS一般在
`~/.jupyter/jupyter_notebook_config.py`
)
```
bash
```
{.python .input}
c.NotebookApp.contents_manager_class = 'notedown.NotedownContentsManager'
```
...
...
@@ -194,8 +182,7 @@ c.NotebookApp.contents_manager_class = 'notedown.NotedownContentsManager'
Jupyter的一个常用做法是在远端服务器上运行,然后通过
`http://myserver:8888`
来访问。
有时候防火墙阻挡了直接访问对应的端口,但ssh是可以的。如果本地机器是linux或者mac(windows通过第三方软件例如putty应该也能支持),那么可以使用端口映射
```
bash
```
{.python .input}
ssh myserver -L 8888:localhost:8888
```
...
...
@@ -204,8 +191,7 @@ ssh myserver -L 8888:localhost:8888
### 运行计时
我们可以通过ExecutionTime插件来对每个cell的运行计时。
```
bash
```
{.python .input}
pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
jupyter nbextension enable execute_time/ExecuteTime
...
...
@@ -222,8 +208,7 @@ jupyter nbextension enable execute_time/ExecuteTime
#### 症状
```
bash
```
{.python .input}
-bash: conda: command not found /’conda‘不是内部或外部命令,也不是可运行的程序
```
...
...
@@ -233,24 +218,21 @@ conda不在系统搜索目录下,无法找到conda可执行文件
##### 药方
```
bash
```
{.python .input}
# linux或者mac系统
export PATH=/path/to/miniconda3/bin:$PATH
# windows用set或者setx
set PATH=C:\path\to\miniconda3\bin;%PATH%
```
```
bash
```
{.python .input}
完成后命令行测试 "conda --version"
如果显示类似于 “conda 4.3.21”,则症状痊愈
```
#### 症状
```
bash
```
{.python .input}
Conda安装正常,conda env -f environment.yml失败
```
...
...
@@ -287,8 +269,7 @@ pip版本太低
##### 药方
```
bash
```
{.python .input}
pip install --upgrade pip
```
...
...
@@ -300,8 +281,7 @@ pip install --upgrade pip
确保系统被支持,比如Ubuntu 14.04/16.04, Mac10.11/10.12(10.10即将支持), Windows 10(win7 未测试), 如果都符合,可以试试命令
```
bash
```
{.python .input}
python -c "import pip; print(pip.pep425tags.get_supported())"
```
...
...
@@ -312,24 +292,23 @@ python -c "import pip; print(pip.pep425tags.get_supported())"
如果看到这样的错误
```
bash
```
{.python .input}
ImportError: No module named mxnet
```
python无法找到mxnet,有可能系统上有多个python版本, 导致pip和python版本不一致
##### 药方
找到pip的安装目录
```
bash
```
{.python .input}
pip --version
```
找到python安装目录
```
bash
```
{.python .input}
which python
# or
whereis python
...
...
@@ -339,15 +318,13 @@ python -c "import os, sys; print(os.path.dirname(sys.executable))"
如果pip目录和python目录不一致,可以改变默认加载的python,比如
```
bash
```
{.python .input}
python3 -c "import mxnet as mx; print(mx.__version__)"
```
或者用和python对应的pip重新安装mxnet
```
bash
```
{.python .input}
pip3 install mxnet --pre
pip2 install mxnet --pre
```
...
...
@@ -357,7 +334,7 @@ pip2 install mxnet --pre
##### 病情分析
假设你看到这个错误:
```
bash
```
{.python .input}
ImportError: libgfortran.so.3: cannot open shared object file: No such file or
directory
```
...
...
@@ -369,24 +346,35 @@ install libgfortran`
#### 症状:可以import mxnet,但是版本不正常(< 0.11.1b20170908)
##### 病情分析
安装时没有指定最新的版本
##### 药方
可以使用pip
install mxnet --upgrade --pre安装最新的mxnet
可以使用pip
install mxnet --upgrade --pre安装最新的mxnet
##### 病情分析
由于系统的问题,无法正确安装最新版本,参考 No matching
distribution found for mxnet>=0.11.1b20170902
### Jupyter Notebook
#### 症状: 打开notebook乱码
##### 病情分析
Windows下不支持编码?
##### 未测试药方
把md文件用文本编辑器保存为GBK编码
### 其他
#### 症状: Windows下curl, tar失败
##### 病情分析
Windows默认不支持curl,tar
##### 药方
下载和解压推荐用浏览器和解压软件,手动拷贝
### 最后
如果你尝试了很多依然一头雾水,可以试试docker安装:https://zh.gluon.ai/install.html#docker
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录