简体   繁体   English

在PyCharm中安装气流包附件

[英]Install airflow package extras in PyCharm

I want to use Airflow package extras s3 and postgres in PyCharm but do not know how to install them (on macOS Sierra). 我想在PyCharm中使用Airflow附加 s3postgres但不知道如何安装它们(在macOS Sierra上)。

My attempts so far 到目前为止我的尝试

Airflow itself can be installed from Preferences > Project > Project interpreter > + but not the extras as far as I can work out. 气流本身可以从首选项 > 项目 > 项目解释器 > +安装,但不是我可以解决的额外功能。 The extras can be installed with pip in the terminal using 附件可以使用pip安装在终端中

$ pip install airflow[s3,postgres]

but they end up in a different interpreter ( ~/anaconda ) than the one used by PyCharm ( /usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7 ). 但他们最终使用的是不同的解释器( ~/anaconda )而不是PyCharm使用的解释器( /usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7 )。

Checking the Python executables in my /usr/local/bin directory I found that only pip3 and pip3.5 point to the PyCharm interpreter, but pip , pip2 , pip2.7 do not. 检查我的/usr/local/bin目录中的Python可执行文件我发现只有pip3pip3.5指向PyCharm解释器,但是pippip2pip2.7没有。

$ ls -la /usr/local/bin | grep pip
-rwxr-xr-x    1 root        admin       204 Dec 21 11:41 pip
-rwxr-xr-x    1 root        admin       204 Dec 21 11:41 pip2
-rwxr-xr-x    1 root        admin       204 Dec 21 11:41 pip2.7
lrwxr-xr-x    1 christofer  admin        34 Nov 21 11:53 pip3 -> ../Cellar/python3/3.5.2_3/bin/pip3
lrwxr-xr-x    1 christofer  admin        36 Nov 21 11:53 pip3.5 -> ../Cellar/python3/3.5.2_3/bin/pip3.5

Browsing the directory of the PyCharm interpreter I found all the expected python executables ( python , python2.7 etc.) pointed to from /usr/local/bin but no pip . 浏览PyCharm解释器的目录,我发现从/usr/local/bin指向的所有预期的python可执行文件( pythonpython2.7等),但没有pip

What I need help with 我需要帮助的是什么

So, the problem could be solved if I/you/we can figure out either 所以,如果我/你/我们能弄明白,问题就可以解决了

  1. how to install airflow[s3,postgres] from within PyCharm, or 如何从PyCharm中安装airflow[s3,postgres] ,或
  2. how to run pip install airflow[s3,postgres] pointing to the PyCharm interpreter. 如何运行pip install airflow[s3,postgres]指向PyCharm解释器。

So, the problem could be solved if I/you/we can figure out either 所以,如果我/你/我们能弄明白,问题就可以解决了

  1. how to install airflow[s3,postgres] from within PyCharm, or 如何从PyCharm中安装气流[s3,postgres],或

  2. how to run pip install airflow[s3,postgres] pointing to the PyCharm interpreter. 如何运行pip install airflow [s3,postgres]指向PyCharm解释器。

Or maybe?: 或者可能?:

  1. Add the ~/anaconda Python to Pycharm ~/anaconda Python添加到Pycharm

To add another python interpreter to Pycharm goto: 要向Pycharm goto添加另一个python解释器:

File -> Settings -> Project: -> Project Interpreter

Press the Gear Button and select more : 按齿轮按钮并选择more

在此输入图像描述

This shows all of the interpreters configured. 这显示了所有配置的解释器。 Select the + button, and select add local : 选择+按钮,然后选择add local

在此输入图像描述

Now you should be able to add your anaconda Python to Pycharm. 现在你应该可以将你的anaconda Python添加到Pycharm了。 You can then select which Python to use as primary for the project, and you can select which Python to run under: 然后,您可以选择要用作项目主要Python的Python,并且可以选择要在其下运行的Python:

Run -> Edit Configurations

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

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