IT记录

日常学习、工作的点滴记录


  • 首页

  • categories

  • archive

  • tags

  • 搜索

ubuntu下将JupyterLab运行为系统服务

发表于 2021-10-16   |   分类于 Jupyterlab   |   暂无评论

创建服务描述文件:

#/etc/systemd/system/jupyter.service

编辑文件:

sudo vim /etc/systemd/system/jupyter.service

把下面的内容复制进去:

[Unit]
Description=Jupyter
After=syslog.target network.target

[Service]
User=supermap
WorkingDirectory=/home/supermap/
ExecStart=/home/supermap/Envirment/anaconda3/bin/jupyter lab

Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

重新载入服务:

sudo systemctl daemon-reload

启动服务:

sudo systemctl start jupyter

查看状态:

sudo systemctl status jupyter --no-pager

可以看到相应的登录地址和token等信息,将其输入浏览器即可访问。

设置为系统启动时自动启动:

sudo systemctl enable jupyter

使用nohup后台运行程序

发表于 2021-10-16   |   分类于 系统应用   |   暂无评论

nohup 英文全称 no hangup,用于在系统后台不挂断地运行命令,退出终端不会影响程序的运行。这个命令会使程序忽略 HUP 信号,保证程序能够正常进行。

nohup 命令,在默认情况下(非重定向时),会输出一个名叫 nohup.out 的文件到当前目录下,如果当前目录的 nohup.out 文件不可写,输出重定向到 $HOME/nohup.out 文件中。让程序在后台运行,可以加上 & 符号。要让程序重新回到终端,可以使用 fg 命令。

$ nohup ./test2.sh > ~/output/logs.txt &

如果你需要同时跑多个程序,可以使用 && 符号。比如:

$ nohup bash -c 'command1 && command2 && command3'> output.txt

相对screen,nohup要简单。

jupyterlab 括号引号自动匹配补全设置

发表于 2021-10-12   |   分类于 Jupyterlab   |   暂无评论

jupyterlab新版中,括号引号自动匹配补全默认是关闭的,需要手工修改:设置-->高级设置编辑器:将notebook中的用户偏好设置中的 "autoClosingBrackets"改为 true。

git push记住用户名和密码

发表于 2021-10-12   |   分类于 Python   |   暂无评论

在Jupyterlab安装了git插件后,管理代码感觉方便了很多,但就是每次git push的时候需要输入用户名和密码。

可以通过credential.helper(凭证助手)来记住Username和Password。

切换到git项目目录下

$ git config credential.helper store
$ git push http://github.com/user/jupyter.git

按照提示输入用户名及密码即可

Ubuntu下使用Pdfplumber转换PDF到图片报错

发表于 2021-10-11   |   分类于 Python   |   暂无评论

Ubuntu下使用pdfplumbert转换PDF到图片报错:attempt to perform an operation not allowed by the security policy `PDF'。这个问题表明:未安装Imagemagick,或者安装后安全策略不允许执行pdf转换PNG。需要安装imagemagick 之后,没有对其做过任何设置处理。

安装Imagemagick

sudo apt install imagemagick

设置Imagemagick权限

cd /etc/ImageMagick-6/

修改policy.xml文件,将涉及pdf那行注释

<!-- <policy domain="coder" rights="none" pattern="PDF" /> -->
1...1112131415161718192021...23

一个高端大气上档次的网站

115 文章
5 分类
51 标签
GitHub 知乎 V2EX SF
© 2026 IT记录
Typecho
主题 - NexT.Pisces