简体   繁体   English

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

[英]Can't install RMySQL on R 3.0.2 (ubuntu 14.04)

so far i had this error;到目前为止,我遇到了这个错误;

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

so i follow what it says at 1.所以我遵循它在 1 中所说的。

i input我输入

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

and then try again on the terminal to install with the command they give me然后在终端上再次尝试使用他们给我的命令进行安装

 R CMD INSTALL RMySQL_<version>.tar.gz

and i get;我明白了;

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’

so looking up i found this recommendations;所以查找我发现了这个建议;

installing RMySQL gives error RS-MySQL.h:32:19: fatal error: mysql.h: No such file 安装 RMySQL 出现错误 RS-MySQL.h:32:19: fatal error: mysql.h: No such file

and following what it says here:并遵循它在这里所说的:

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

i don't get this step;我不明白这一步;

3. Edit or create the file Renviron.site and add the variable MYSQL_HOME which contains the location of your MySQL install. 3. 编辑或创建文件 Renviron.site 并添加包含 MySQL 安装位置的变量 MYSQL_HOME。 The file typically isn't created when installing R, so you may need to create it yourself.安装 R 时通常不会创建该文件,因此您可能需要自己创建它。 You will want to place it under the /etc directory in your R Home area.您需要将它放在 R Home 区域的 /etc 目录下。 If you don't know where that is, you can issue R.home() at your R prompt.如果您不知道那在哪里,可以在 R 提示符下发出 R.home() 。 You will be adding a variable named MYSQL_HOME in variable=value syntax.您将在 variable=value 语法中添加一个名为 MYSQL_HOME 的变量。 Here's an example: Location of Renviron.site: C:/PROGRA~1/R/R-2.11~1.0/etc/Renviron.site Content is: MYSQL_HOME=C:/PROGRA~1/MySQL/MYSQLS~1.0/下面是一个例子: Renviron.site 的位置:C:/PROGRA~1/R/R-2.11~1.0/etc/Renviron.site 内容是:MYSQL_HOME=C:/PROGRA~1/MySQL/MYSQLS~1.0/

because, when im in the Renviron.site, it doesn't let me edit on it anything, also i dont have clear what i should put there, anyway, i writte因为,当我在 Renviron.site 时,它​​不允许我对其进行任何编辑,我也不知道我应该在那里放什么,无论如何,我写

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

but i cant save it, it doesnt let me, because it says im not allowed, and i can't create a new file or anything there in /etc/但我无法保存它,它不允许我,因为它说我不允许,而且我无法在 /etc/ 中创建新文件或任何内容

对我来说,我只需要获得包含这些文件的正确包

sudo apt-get install libmysqlclient-dev

For my ubuntu version 14.04.3 all I needed to do was:对于我的 ubuntu 版本 14.04.3,我需要做的就是:

install.packages("RMySQL", dependencies=TRUE)

Had more of a problem on a windows machine a while back but, it turned out it was a compatibility issue with perl so I (1) uninstalled perl, (2) installed RMySQL in a same way then (3) reinstalled perl.不久前在 Windows 机器上遇到了更多问题,但事实证明这是与 perl 的兼容性问题,因此我 (1) 卸载了 perl,(2) 以相同的方式安装了 RMySQL,然后 (3) 重新安装了 perl。

Has worked ever since.从那以后一直工作。

Your inputs are wrong, first of all get rid of the greater than and less than signs.你的输入是错误的,首先去掉大于号和小于号。 Then for the MySQL include directory run the command:然后对于 MySQL 包含目录运行命令:

$ mysql_config --include

SO if it's the same path that you already provided instead of:所以,如果它与您已经提供的路径相同,而不是:

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

enter:进入:

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

for library path enter the command:对于库路径输入命令:

$ mysql_config --libs

and same with the above enter the path without the signs for me it is like:和上面一样,进入没有标志的路径对我来说就像:

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

Finally in the last input instead of "version" specify a version number.最后在最后输入而不是“version”指定一个版本号。 These steps should fix your problem.这些步骤应该可以解决您的问题。 For editing and writing in the /etc/ directory you should have the permissions, if you are the administrator you can do that by sudo command.要在 /etc/ 目录中进行编辑和写入,您应该具有权限,如果您是管理员,则可以通过 sudo 命令执行此操作。 and also the path that you provided is for windows not linux.以及您提供的路径适用于 Windows 而不是 linux。

这个对我有用:

sudo apt-get install r-cran-rmysql

When I tried installing RMySQL in R, it prompted an error saying:当我尝试在 R 中安装 RMySQL 时,它提示一条错误消息:

Configuration failed because no mysql client library was found. Try installing:
 * deb: libmariadbclient-dev | libmariadb-client-lgpl-dev (Debian, Ubuntu)

Then I just did:然后我就做了:

sudo apt-get install libmariadbclient-dev
sudo apt-get install libmariadb-client-lgpl-dev

And I was able to install RMySQL in R using:我能够使用以下方法在 R 中安装 RMySQL:

install.packages("RMySQL", dependencies=TRUE)

This because of mysql.h (headers) file is missing from the machine.这是因为机器中缺少 mysql.h(头文件)文件。

Setp :1 Try to find mysql.h file from machine Setp :1尝试从机器中找到 mysql.h 文件

find / -name mysql.h

if you could not find Setp :2 Try to re install如果找不到Setp :2尝试重新安装

sudo yum reinstall mysql-devel
Sudo yum reinstall mysql-client

If its community server如果它的社区服务器

sudo yum reinstall mysql-community-devel
Sudo yum reinstall mysql-community-client
  • you can specify by version also您也可以按版本指定

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

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