V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
JerningChan
V2EX  ›  Python

请教个 pycharm 远程调试代码的问题

  •  
  •   JerningChan · 2021-10-12 22:29:29 +08:00 · 2811 次点击
    这是一个创建于 898 天前的主题,其中的信息可能已经有所发展或是发生改变。
    大家好,我目前有个工作环境,是接手别人的,架构呢,暂时不能改动

    1,上手原来的代码和其他 mssql 服务都是放在 win2012 上边运行的,然后他是直接远程桌面上去调试代码的
    2,我日常工作环境是 mac,我自己的项目都是在 centos7 跑的,所以我很多时候都是 pycharm 远程去调试服务器的代码

    但是对于 win2012 才能用 pycharm 远程调试呢?

    我现在还有个啧中的办法就是,本地写好了,把整个文件 cp 进去。。。再运行,但是觉得实在是不方便,而且远程桌面修改代码,也实在不太爽快
    16 条回复    2021-10-14 17:08:16 +08:00
    UN2758
        1
    UN2758  
       2021-10-12 23:07:59 +08:00
    你在 win 服务器上装个 ssh,pycharm 里配置远程解释器就行了吧
    KallyDev
        2
    KallyDev  
       2021-10-12 23:08:09 +08:00 via iPhone
    要是 Linux 服务器还能通过 Remote SSH 进行调试,Windows Server 版本太低确实不太方便。不过手动 copy 也太麻烦了吧,公司内部没有 Git 服务器吗?

    git commit && git push
    git pull
    tjx20114
        3
    tjx20114  
       2021-10-13 00:01:07 +08:00
    专业版可以用,
    tjx20114
        4
    tjx20114  
       2021-10-13 00:02:08 +08:00
    1. deployment
    https://www.jetbrains.com/help/pycharm/tutorial-deployment-in-product.html#deployment-tools
    ctrl+s 保存自动上传服务器
    2. 配置远程解释器
    JerningChan
        5
    JerningChan  
    OP
       2021-10-13 00:37:11 +08:00
    @UN2758 嗯,正打算,实在没其他办法就弄这个,不过话说那个 win 系统的 github openssh 服务,好像还是 bate 版?
    @KallyDev 没呢。。。还在用 svn
    @tjx20114 哦?好的,谢谢大佬,明天看看这个
    UN2758
        6
    UN2758  
       2021-10-13 00:41:59 +08:00
    @JerningChan #5 2021 版的没有实际用过,之前遇到的场景都是 win 本地连接到远程 linux
    UN2758
        7
    UN2758  
       2021-10-13 00:42:08 +08:00
    2012
    ufo22940268
        8
    ufo22940268  
       2021-10-13 07:46:02 +08:00
    能访问远端的调试的端口就能远程调试,具体[教程]( https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html#remote-debug-config)
    smallX
        9
    smallX  
       2021-10-13 09:04:09 +08:00
    服务器是 win, 好骚...
    JerningChan
        10
    JerningChan  
    OP
       2021-10-13 09:22:45 +08:00
    @smallX 是啊,没办法,他们弄那些什么国产软件。。。然后非得用 winserver

    @UN2758 按正常情况都是应该这样的。。。然而。。。没办法😂

    @ufo22940268 哦,好的,谢谢 dalao
    JerningChan
        11
    JerningChan  
    OP
       2021-10-14 09:59:45 +08:00
    @UN2758 win2012 安装 openssh 然后配置远程解释器不太行,好像有 bug
    我用的 pycharm 2021.1.3
    但是配置 远程目录是可以上传下载的
    目前暂时只能 本地写好,上传,然后 ssh 来运行了
    UN2758
        12
    UN2758  
       2021-10-14 10:03:30 +08:00
    你配置远程解释器在哪一步失败了?正常的 ssh 能连上服务器吗? sftp 看样子是可以用
    JerningChan
        13
    JerningChan  
    OP
       2021-10-14 11:17:36 +08:00
    @UN2758 肯定可以连上的,就是填那个 python 路径时
    1,按 win 的写法,就找不到路径

    2,按 linux 的写法,就提示出错

    https://imgur.com/a/tez8Sdh
    UN2758
        14
    UN2758  
       2021-10-14 11:40:13 +08:00
    @JerningChan #13 https://www.jetbrains.com/help/pycharm/configuring-remote-interpreters-via-ssh.html pycharm 目前还不支持配置 remote Windows interpreter,是我大意了,那就只能远程桌面了
    JerningChan
        15
    JerningChan  
    OP
       2021-10-14 14:51:10 +08:00
    @UN2758 对啊,不过目前更新比以前方便就好了,毕竟,上家居然能在 win 系统来跑,我也是够服的了
    为了工资,没办法😂
    abersheeran
        16
    abersheeran  
       2021-10-14 17:08:16 +08:00
    建议用代码同步工具同步上去……调试在本地
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2941 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 15:08 · PVG 23:08 · LAX 08:08 · JFK 11:08
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.