【发布时间】:2020-07-19 02:52:05
【问题描述】:
为了加快启动项目,我创建了一个小型 bash 脚本,它执行以下操作:
- 接受一个参数(项目名称)
- 移动到该项目的目录
- 启动虚拟环境
- 启动一个 jupyter notebook
#!/bin/bash
if [ "$1" == "k3" ]; then
project_path="tau-code/k3-analysis/"
fi
codepath="/media/peter/somedrive/code"
full_path="$codepath/$project_path"
# Go to directory of project
cd $full_path
# Start environment & notebook if available
pipenv shell
jupyter notebook --ip=0.0.0.0
它激活环境,但不运行jupyter 命令。当我退出环境时,我看到了错误:
line 16: jupyter: command not found
我可以在我新创建的环境中手动输入jupyter notebook --ip=0.0.0.0,这确实有效。
可能是什么问题?
【问题讨论】:
-
可以在新创建的环境中手动检查
which jupyter吗?并在新创建的环境中手动运行env?之后在你的 bash 脚本中也一样 - pipenv shellpipenv shellenvjupyter notebook --ip=0.0.0.0我在某个地方认为这是一个路径问题..
标签: bash automation jupyter-notebook jupyter