我是Python的新手。我是Vagrant的新手。但是,我的团队使用自己选择的Vagrant VM和IDE运行项目。我之所以选择PyCharm,是因为我过去曾经使用过一些JetBrains产品。
我真的很希望能够在运行时对其进行可视化调试。设置断点,查看变量值等。
PyCharm有一个帮助部分(及其上方的相关文章): https://www.jetbrains.com/help/pycharm/configuring-product-to-work-on-the-vm.html
我已经全部完成了,但是在Project-> Project Interpreter下,路径映射似乎列出了主机和Vagrant VM之间的所有共享文件夹。这些共享文件夹是
我认为它没有正确指向项目或其依赖库。
我还在底部显示一条黄色消息,提示未找到Python打包工具。
如果我点击调试,我将在终端中获得以下输出:
bash: line 0: cd: /vagrant/app: No such file or directory
pydev debugger: process 2032 is connecting
Connected to pydev debugger (build 191.6183.50)
Traceback (most recent call last):
File "/home/vagrant/.pycharm_helpers/pydev/pydevd.py", line 1741, in
<module>
main()
File "/home/vagrant/.pycharm_helpers/pydev/pydevd.py", line 1735, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/vagrant/.pycharm_helpers/pydev/pydevd.py", line 1135, in run
pydev_imports.execfile(file, globals, locals) # execute the script
IOError: [Errno 2] No such file or directory: '/vagrant/app/__main__.py'
它还为自己打开了其中包含“ pydev.py”的标签:
Remote file /home/vagrant/.pycharm_helpers/pydev/pydevd.py is mapped to the
local path C:\Users\<my username>\vagrant\.pycharm_helpers\pydev\pydevd.py
and can't be found. You can continue debugging, but without the source. To
fix that you can do one of the following:
如何通过在Vagrant VM上运行的代码从主机上的PyCharm调试设置?