简体   繁体   English

将 apache-airflow 库添加到 PyCharm

[英]Adding apache-airflow library to PyCharm

I've been trying to wrap my head about how can I add apache-airflow library to my virtual env in windows.我一直在想如何将 apache-airflow 库添加到 Windows 中的虚拟环境中。

  1. Apache-airflow is installed on Linux which is hosted by VirtualBox on my machine. Apache-airflow 安装在Linux 上,它由我机器上的VirtualBox托管。

  2. PyCharm is installed on Windows 10 where I am trying to figure a way how to add that library to my PyCharm(Community Edition). PyCharm 安装在 Windows 10 上,我正在尝试找出如何将该添加到我的 PyCharm(社区版)的方法。

Basically I want to keep apache-airflow on my virtual machine and develop DAGs and necessary components on my Windows environment.基本上我想在我的虚拟机上保留 apache-airflow 并在我的 Windows 环境中开发 DAG 和必要的组件。

How can I achieve this?我怎样才能做到这一点? Any help would be appreciated.任何帮助,将不胜感激。

If the code is going to be running on the linux VM.如果代码将在 linux VM 上运行。 Add the python library on the VM.在 VM 上添加 python 库。 Create a shared folder between your Windows machine and the VM.在 Windows 计算机和 VM 之间创建一个共享文件夹。 Save your pycharm project in the shared folder.将您的 pycharm 项目保存在共享文件夹中。

This will "work" but have a few significant draw backs:这将“有效”,但有一些明显的缺点:

  1. Pycharm won't have any "code completion" for the imported libraries. Pycharm 不会为导入的库提供任何“代码完成”。
  2. Pycharm will complain that the library doesn't exist. Pycharm 会抱怨该库不存在。
  3. You will have to test your code either through ssh to the remote machine or in a terminal on the remote machine.您必须通过 ssh 到远程机器或在远程机器上的终端中测试您的代码。

Another option is to just install pycharm in the linux VM, if you are using a linux distro with a desktop, like ubuntu for instance.另一种选择是在 linux VM 中安装 pycharm,如果您使用的是带有桌面的 linux 发行版,例如 ubuntu。

If pycharm isn't required, VS Code has a nice plugin for remote development: https://code.visualstudio.com/docs/remote/ssh如果不需要 pycharm,VS Code 有一个不错的远程开发插件: https ://code.visualstudio.com/docs/remote/ssh

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM