无法在R 3.0.2上安装RMySQL(ubuntu 14.04)

到目前为止,我有这个错误;
Configuration error:
  could not find the MySQL installation include and/or library
  directories.  Manually specify the location of the MySQL
  libraries and the header files and re-run R CMD INSTALL.

INSTRUCTIONS:

1. Define and export the 2 shell variables PKG_CPPFLAGS and
   PKG_LIBS to include the directory for header files (*.h)
   and libraries,for example (using Bourne shell syntax):

      export PKG_CPPFLAGS="-I<MySQL-include-dir>"
      export PKG_LIBS="-L<MySQL-lib-dir> -lmysqlclient"

   Re-run the R INSTALL command:


      R CMD INSTALL RMySQL_<version>.tar.gz

2. Alternatively,you may pass the configure arguments
      --with-mysql-dir=<base-dir> (distribution directory)
   or
      --with-mysql-inc=<base-inc> (where MySQL header files reside)
      --with-mysql-lib=<base-lib> (where MySQL libraries reside)
   in the call to R INSTALL --configure-args='...' 

   R CMD INSTALL --configure-args='--with-mysql-dir=DIR' RMySQL_<version>.tar.gz

ERROR: configuration failed for package ‘RMySQL’
* removing ‘/home/samuel/R/x86_64-pc-linux-gnu-library/3.0/RMySQL’
Warning in install.packages :
  installation of package ‘./RMySQL_0.9-3.tar.gz’ had non-zero exit status

所以我按照1所说的说法.

我输入

export PKG_CPPFLAGS="-I</usr/include/mysql>"
export PKG_LIBS="-L</usr/lib/mysql> -lmysqlclient"

然后再次尝试在终端上安装他们给我的命令

R CMD INSTALL RMySQL_<version>.tar.gz

而我得到;

checking for unistd.h... yes
checking mysql.h usability... no
checking mysql.h presence... no
checking for mysql.h... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I</usr/include/mysql>     -fpic  -O3 -pipe  -g  -c RS-DBI.c -o RS-DBI.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I</usr/include/mysql>     -fpic  -O3 -pipe  -g  -c RS-MySQL.c -o RS-MySQL.o
In file included from RS-MySQL.c:22:0:
RS-MySQL.h:32:19: fatal error: mysql.h: No existe el archivo o el directorio
 #include <mysql.h>
                   ^
compilation terminated.
make: *** [RS-MySQL.o] Error 1
ERROR: compilation failed for package ‘RMySQL’

所以抬头我发现了这个建议;

installing RMySQL gives error RS-MySQL.h:32:19: fatal error: mysql.h: No such file

并遵循它在这里所说的:

http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL

我没有这一步;

3.编辑或创建文件Renviron.site并添加包含MySQL安装位置的变量MYSQL_HOME.安装R时通常不会创建该文件,因此您可能需要自己创建.您需要将它放在R Home区域的/ etc目录下.如果您不知道它在哪里,可以在R提示符下发出R.home().您将在variable = value语法中添加名为MYSQL_HOME的变量.这是一个例子:
Renviron.site的位置:C:/PROGRA~1/R/R-2.11〜1.0/etc/Renviron.site
内容是:
MYSQL_HOME = C:/PROGRA~1/MySQL/MYSQLS~1.0/

因为,当我在Renviron.site中,它不会让我编辑任何东西,我也不清楚我应该放在那里,无论如何,我写

MYSQL_HOME=C:/PROGRA~1/MySQL/MYSQLS~1.0/***

但我不能保存它,它不会让我,因为它说我不允许,我不能在/ etc /中创建一个新文件或任何东西

你的输入是错误的,首先要摆脱大于和小于标志.然后为MySQL include目录运行命令:
$mysql_config --include

如果它与您已经提供的路径相同而不是:

export PKG_CPPFLAGS="-I</usr/include/mysql>"

输入:

export PKG_CPPFLAGS="-I/usr/include/mysql"

对于库路径输入命令:

$mysql_config --libs

和上面一样进入路径没有我的标志就像是:

export PKG_LIBS="-L/usr/lib/x86_64-linux-gnu -lmysqlclient"

最后在最后一个输入而不是“版本”中指定版本号.这些步骤可以解决您的问题.要在/ etc /目录中进行编辑和编写,您应具有权限,如果您是管理员,则可以通过sudo命令执行此操作.而且你提供的路径是windows而不是linux.

相关文章

ubuntu退出redis的示例:指定配置文件方式启动源码redis:roo...
ubuntu中mysql改密码忘了的解决方法:1.在终端中切换到root权...
ubuntu安装mysql失败的解决方法原因:可能是原有的MySQL还有...
使用centos和ubuntu建站的区别有以下几点1.CentOS是Linux发行...
ubuntu图形界面和字符界面切换的方法:可以通过快捷键CTRL+A...
ubuntu中重启mysql失败的解决方法1.首先,在ubuntu命令行中,...