在服务器搭建Python环境
- 先下载anaconda的环境,mkdir anaconda建一个文件夹,然后cd anaconda进入这个文件夹。
- 下载anaconda
wget https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh
- 开始安装
bash Anaconda3-2019.03-Linux-x86_64.sh
- 初始化jupyter配置文件,记得保存这个配置文件的地址。
例如/root/.jupyter/jupyter_notebook_config.py - 配置密码
先进入Python环境,输入ipython,然后再输入以下两端代码,并设置密码。from notebook.auth import passwd passwd()
- 把回执复制下来,然后输入exit()退出。
- 配置jupyter
用vim打开之前那个配置文件
然后按i输入以下代码,输入:wq退出vim /root/.jupyter/jupyter_notebook_config.py
c.NotebookApp.ip='*' c.NotebookApp.password=u'sha1:d1ffce1b5f46:af2719a3e94a8c9d8e71a7646864923578 981af0' c.NotebookApp.open_browser = False c.NotebookApp.port=8888
- 启动jupyter
jupyter notebook --ip=0.0.0.0 --no-browser --allow-root
- 保持jupyter一直运行
nohup jupyter notebook --allow-root > jupyter.log 2>&1 &
- 最后用ip加端口就可以打开,例如http://101.37.75.132:5555。
大功告成🤣🤣🤣😂