Installing RMySQL in mavericks

后端 未结 5 1865
忘了有多久
忘了有多久 2020-12-14 04:59

I am having trouble installing RMySQL. I am trying to install it from its source in the following way:

install.packages(\"/path/to/package/RMySQL_0.9-3.tar.g         


        
5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-14 05:38

    I followed the above instructions:

    brew install mysql
    

    Then in RStudio:

    Sys.setenv(PKG_CPPFLAGS = "-I/usr/local/include/mysql")
    Sys.setenv(PKG_LIBS = "-L/usr/local/lib -lmysqlclient")
    install.packages("RMySQL", type="source")
    

    It gives the error:

    In file included from RS-MySQL.c:22: 
    ./RS-MySQL.h:32:10: fatal error: 'mysql.h' file not found
    #include 
             ^ 1 error generated. 
    make: *** [RS-MySQL.o] Error 1 
    ERROR: compilation failed for package ‘RMySQL’
    * removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RMySQL’
    

    To solve it, change the last command in RStudio to:

    install.packages("RMySQL", 
        configure.args="--with-mysql-dir=/usr/local/bin/  
        --with-mysql-inc=/usr/local/include/mysql  
        --with-mysql-lib=/usr/local/lib", type="source")
    

    Hope this helps.

提交回复
热议问题