r - 安装 RMySQL 时出错(Ubuntu 14.04 中的 MySQL 5.5.37)

标签 r ubuntu rmysql

每次我尝试安装 RMySQL 时,我都会收到以下错误:

Installing package into ‘/home/ehsan/R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
* installing *source* package ‘RMySQL’ ...
** package ‘RMySQL’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for compress in -lz... yes
checking for getopt_long in -lc... yes
checking for mysql_init in -lmysqlclient... yes
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
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/mysql.h     -fpic  -O3 -pipe  -g  -c RS-DBI.c -o RS-DBI.o
cc1: warning: /usr/include/mysql/mysql.h: not a directory [enabled by default]
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql/mysql.h     -fpic  -O3 -pipe  -g  -c RS-MySQL.c -o RS-MySQL.o
cc1: warning: /usr/include/mysql/mysql.h: not a directory [enabled by default]
In file included from RS-MySQL.c:22:0:
RS-MySQL.h:32:19: fatal error: mysql.h: No such file or directory
 #include <mysql.h>
                   ^
compilation terminated.
make: *** [RS-MySQL.o] Error 1
ERROR: compilation failed for package ‘RMySQL’
* removing ‘/home/ehsan/R/x86_64-pc-linux-gnu-library/3.0/RMySQL’
The downloaded source packages are in
    ‘/tmp/RtmpTRRPqg/downloaded_packages’
Warning message:
In install.packages("RMySQL") :
  installation of package ‘RMySQL’ had non-zero exit status**

貌似找不到mysql.h,我搜索了一下,把路径改成了

export PKG_CPPFLAGS="-I/usr/R/include/mysql/mysql.h"

但是没有成功。有很多人遇到过同样的问题,但他们的解决方案(如果存在的话)都不适合我。如果有任何意见或帮助,我将不胜感激。

#Update:问题已解决#

下面的命令似乎解决了这个问题:

sudo apt-get install r-cran-rmysql

最佳答案

如前所述,以下命令对我有用:

sudo apt-get install r-cran-rmysql

关于r - 安装 RMySQL 时出错(Ubuntu 14.04 中的 MySQL 5.5.37),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24788670/

相关文章:

mysql - 无法连接到数据库错误 - R+RMySQL/XAMPP

R:在谷歌搜索一个字符串并返回点击数

linux - 我们可以 memset 与我们可以 malloc 的大小相同吗?

r - 如何使用字符对象使用 dplyr 重命名 R 中的列?

linux - 使用 bash 格式化在 shell 中打印的数组

代码失败时,Linux中的PHP(LAMP)不显示错误原因? (Ubuntu)

mysql - 在 R 粘贴函数中混合单引号和双引号?

mysql - 如何安装和配置 RMySQL 以连接到远程 MySQL 数据库 (AWS RDS)?

r - 如何在R中删除具有相同值的列

r - 序列构造,如果lower大于上限,则创建一个空序列