问题描述
我有一台无法访问Internet的Linux机器,我需要在没有root特权的情况下在其上安装Jupyter笔记本.我可以将任何文件复制到我的机器上,然后它们将这些文件复制到远程机器上.例如,如何不使用Anaconda就能获取并安装所有依赖项?点子就可以了.
I have a Linux machine that cannot access the internet and I need to install the Jupyter notebook on it, without root privileges. I can copy whatever files to my machine and them copy those files to the remote machine. How can I get all dependencies and install them, without using Anaconda, for example? Pip is ok.
推荐答案
警告:由于在virtualenv中--relocatable
选项可能弃用,此答案将来可能会失败
warning: this answer might fail in future due to a possible deprecation in --relocatable
option in virtualenv
想法:在另一台计算机上创建可重定位虚拟环境,在其中安装jupyter,然后将其tar移至所述linux计算机,解压缩并获利
idea: create a relocatable virtualenv in another computer, install jupyter in there, and tar and move it to the said linux machine, untar it, and profit
Nb.要安装virtualenv,请运行pip install virtualenv
Nb. To install virtualenv, run pip install virtualenv
第1步:创建一个virtualenv
step 1: create a virtualenv
$ virtualenv .venv
第2步:激活.venv
step 2: activate .venv
$ . .venv/bin/activate
第3步:安装jupyter
step 3: install jupyter
$ pip install jupyter
第4步:将.venv标记为可重定位
step 4: mark .venv as relocatable
$ virtualenv --relocatable .venv
第5步:tar .venv目录
step 5: tar the .venv directory
$ tar czfv venv.tgz .venv/
第6步:移至离线linux计算机,然后解压缩
step 6: move to offline linux machine, and untar
$ tar xvzf venv.tgz
第7步:激活virtualenv以使用它
step 7: activate virtualenv to use it
$ . .venv/bin/activate
这篇关于离线安装Jupyter Notebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!