美文网首页
安装Airflow遇到的问题以及解决过程

安装Airflow遇到的问题以及解决过程

作者: 木曜 | 来源:发表于2016-04-26 20:30 被阅读0次

    1.安装pip

    1.1pip下载

    # wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate
    

    1.2 pip 安装

    # tar -xzvf pip-1.5.4.tar.gz
    # cd pip-1.5.4
    # python setup.py install
    

    1.3 pip 更新

    sudo pip install airflow
    ```
    ### 2.安装Airflow
    #### 2.1第一次安装airflow
    ```
    sudo pip install airflow
    ```
    
    #### 2.2报错:
      >File "numpy/core/setup.py", line 408, in generate_config_h
        'depends': lib_depends},
      File "numpy/core/setup.py", line 40, in check_types
        from setuptools import setup, Command
      File "numpy/core/setup.py", line 269, in check_types
        'pandas/index.pyx',
    SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
    
    ####2.3.安装airflow报错,需要安装python-devel
    ```
    sudo yum install python-devel
    ```
    >[sudo] password for etluser: 
    已加载插件:langpacks
    Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
    base                                                                                    | 3.6 kB  00:00:00     
    epel                                                                                    | 4.3 kB  00:00:00     
    extras                                                                                  | 3.4 kB  00:00:00     
    updates                                                                                 | 3.4 kB  00:00:00     
    (1/4): extras/7/x86_64/primary_db                                                       | 117 kB  00:00:00     
    (2/4): epel/x86_64/updateinfo                                                           | 540 kB  00:00:00     
    (3/4): epel/x86_64/primary_db                                                           | 4.1 MB  00:00:04     
    (4/4): updates/7/x86_64/primary_db                                                      | 4.1 MB  00:00:04     
    正在解              
    完毕!
    
    ####2.4 再次安装Airflow,安装成功
    ```
    sudo pip install airflow
    ```
    >Collecting airflow
    Running setup.py install for sqlalchemy ... done
      Running setup.py install for MarkupSafe ... done
      Running setup.py install for Mako ... done
      Successfully installed 
    安装成功
    
    ### 3.解决MySqlOperator的问题:
    #### 3.1 MySqlOperator import报错
    ```
    ImportError: cannot import name MySqlOperator
    ```
    
    ####3.2 因为缺少mysqlclient导致,安装mysqlclient
    ```
    sudo pip install airflow[mysql]
    ```
    >报错:
    Collecting mysqlclient>=1.3.6 (from airflow[mysql])
      Downloading mysqlclient-1.3.7.tar.gz (79kB)
        100% |████████████████████████████████| 81kB 24kB/s 
        Complete output from command python setup.py egg_info:
        sh: mysql_config: 未找到命令
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/tmp/pip-build-fvpH52/mysqlclient/setup.py", line 17, in <module>
            metadata, options = get_config()
          File "setup_posix.py", line 44, in get_config
            libs = mysql_config("libs_r")
          File "setup_posix.py", line 26, in mysql_config
            raise EnvironmentError("%s not found" % (mysql_config.path,))
        EnvironmentError: mysql_config not found
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-fvpH52/mysqlclient/
    
    ####3.3 安装mysqlclient报错,需要安装python-devel mysql-devel
    ```
    sudo yum install python-devel mysql-devel
    ```
    >已加载插件:langpacks
    软件包 python-devel-2.7.5-34.el7.x86_64 已安装并且是最新版本
    正在解决依赖关系
    --> 正在检查事务
    ---> 软件包 mariadb-devel.x86_64.1.5.5.47-1.el7_2 将被 安装
    --> 解决依赖关系完成
    
    
    ### 3.4 安装Airflow
    ```
    sudo pip install airflow[mysql]
    ```
    >Requirement already satisfied (use --upgrade to upgrade): airflow[mysql] in /usr/lib/python2.7/site-packages
    ...
    Successfully installed mysqlclient-1.3.7
    
    
    
    
    
    

    相关文章

      网友评论

          本文标题:安装Airflow遇到的问题以及解决过程

          本文链接:https://www.haomeiwen.com/subject/jntcrttx.html