pycharm 使用远程服务器 jupyter (本地jupyter同理)

1. 远程服务器miniconda 环境中创建jupyter环境

# 1. 激活环境
conda activate envname

#2. 在环境中安装jupyter
pip install jupyter
# 或者 
conda install jupyter

#3. 生成jupyter_notebook_config.py文件
jupyter notebook --generate-config

#4. 设置密码
jupyter notebook password
#此处为输出-----------------------------
Enter password:
Verify password:
[NotebookPasswordApp] Wrote hashed password to /.jupyter/jupyter_notebook_config.json
#---------------------------

#5.查看密码   路径根据上一步的输出根更改  并复制模糊的字符串,不带引号
vim /.jupyter/jupyter_notebook_config.json

在这里插入图片描述

#6. 修改jupyter_notebook_config.py文件 路径对应更改
vim /.jupyter/jupyter_notebook_config.py

#----------------------------在文件末尾加入以下内容。。 password 引号中为上一步中复制的内容
c.NotebookApp.ip='*' # 修改ip
c.NotebookApp.allow_remote_access = True  # 允许远程连接
c.NotebookApp.password = u'……'  # 与json文件生成的密码对应
c.NotebookApp.open_browser = False  # 不自动打开浏览器

2. 启动服务

并指定端口为9999 可自定义更改

jupyter notebook --no-browser --port=10999  

在这里插入图片描述

3. 查看关闭服务

## 停止服务
jupyter notebook stop


# 失效的情况下,可以使用
#查看当前jupyter端口
jupyter notebook list 
# 通过端口获得pid
lsof -n -i4TCP:[port-number] 
## 查看端口信息;
lsof -i :[port-number] 
 # 删除进程
kill -9 [PID]

4安装kernel

conda activate <envname>
conda install nb_conda_kernels

#可有可无
source activate xxx 

# 中文部分换成自己的,其他部分不用改
python -m ipykernel install --user --name <envname> --display-name "<envname>"

## 查看已有的kernel
jupyter kernelspec list

#完成后启动jupyter服务

5.链接pycharm

1.

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

2.

在这里插入图片描述

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
要在PyCharm远程连接Linux上的Jupyter Notebook,你需要按照以下步骤进行设置: 1. 在Linux服务器上安装Jupyter Notebook并生成密码密钥。你可以使用以下命令安装Jupyter Notebook并生成密钥: ``` pip install jupyter jupyter notebook --generate-config jupyter notebook password ``` 2. 修改Jupyter Notebook的配置文件。使用文本编辑器打开配置文件`~/.jupyter/jupyter_notebook_config.py`,并进行以下修改: ``` c.NotebookApp.allow_remote_access = True c.NotebookApp.ip = '*' c.NotebookApp.open_browser = False c.NotebookApp.password = 'your_password' c.NotebookApp.port = 8888 ``` 3. 启动Jupyter Notebook。在Linux服务器上运行以下命令启动Jupyter Notebook: ``` jupyter notebook ``` 4. 在PyCharm中配置远程连接。打开PyCharm,点击"File" -> "Settings" -> "Project Interpreter",然后点击右上角的齿轮图标,选择"Add" -> "SSH Interpreter"。填写Linux服务器连接信息,并选择正确的Python解释器路径。 5. 连接远程Jupyter Notebook。在PyCharm中,点击"View" -> "Tool Windows" -> "Python Console",然后输入以下命令连接远程Jupyter Notebook: ``` import jupyter_client jupyter_client.kernelspec.find_kernel_specs() ``` 这样,你就可以在PyCharm远程连接Linux上的Jupyter Notebook了。请确保你已经正确配置了SSH连接和Python解释器路径。 #### 引用[.reference_title] - *1* [本地pycharm连接远程linux服务器使用jupyter](https://blog.csdn.net/hpccph15/article/details/125170565)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [解决pycharm 连接服务器使用Jupyter Notebook无法运行问题](https://blog.csdn.net/Fuziqp/article/details/121511821)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [关于如何在本地的pycharm上面使用远程服务器jupyter notebook问题](https://blog.csdn.net/m0_50434358/article/details/123883643)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

DreamBoy@

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值