zoukankan      html  css  js  c++  java
  • R软件中 文本分析安装包 Rjava 和 Rwordseg 傻瓜式安装方法四部曲

      这两天,由于要做一个文本分析的内容,所以搜索了一天R语言中的可以做文本分析的加载包,但是在安装包的过程,真是被虐千百遍,总是安装不成功。特此专门写一篇博文,把整个心塞史畅快的释放一下。

    --------------------------------------------------------------------------------回归正题,华丽丽的分割线-----------------------------------------------------------------------------

    第一:在安装这两个包之前,你需要安装JRE(Java Runtime Environment)链接地址:http://rj.baidu.com/soft/detail/10463.html?ald (选择普通下载吧,不然还要多下一个软件)。

    第二 : 将第一步下载的软件安装成功后,一定要设置环境变量,切记一定要设置,不然无法进行下去。设置方见:http://jingyan.baidu.com/article/9f63fb91d87fb0c8400f0e93.html(这是win7的设置办法)

    第三:安装Rjava包,install.packages('rJava')。如果遵循了第一步,第二步,那么这一步就可以成功安装啦。

    第四:安装Rwordseg包,安装这个包我可是大费周折。

            来段小插曲,如果你没有按照上述的1、2、3步来,接下你你可能在:install.packages("Rwordseg", repos = "http://R-Forge.R-project.org", type = "source")

    着的实收会出现一个问题错误代码如下:

    > install.packages('Rwordseg',repos = "http://R-Forge.R-project.org")
    installing the source package ‘Rwordseg’
    
    trying URL 'http://R-Forge.R-project.org/src/contrib/Rwordseg_0.2-1.tar.gz'
    Content type 'application/x-gzip' length 5445754 bytes (5.2 MB)
    downloaded 5.2 MB
    
    * installing *source* package 'Rwordseg' ...
    ** R
    ** demo
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
    *** arch - i386
    一月 13, 2016 9:15:37 上午 org.ansj.util.MyStaticValue <clinit>
    警告: not find library.properties in classpath use it by default !
    一月 13, 2016 9:15:37 上午 org.ansj.library.UserDefineLibrary loadLibrary
    警告: init userLibrary  waring :library/default.dic because : not find that file or can not to read !
    一月 13, 2016 9:15:37 上午 org.ansj.library.UserDefineLibrary initAmbiguityLibrary
    警告: init ambiguity  waring :library/ambiguity.dic because : not find that file or can not to read !
    一月 13, 2016 9:15:37 上午 org.ansj.library.UserDefineLibrary loadFile
    信息: init user userLibrary ok path is : C:\Program Files\R\R-3.2.3\library\Rwordseg\config\userdic
    一月 13, 2016 9:15:38 上午 org.ansj.library.InitDictionary init
    信息: init core library ok use time :1111
    一月 13, 2016 9:15:39 上午 org.ansj.library.NgramLibrary <clinit>
    信息: init ngram ok use time :975
    *** arch - x64
    Error : .onLoad failed in loadNamespace() for 'rJava', details:
      call: inDL(x, as.logical(local), as.logical(now), ...)
      error: 无法载入共享目标对象‘C:/Program Files/R/R-3.2.3/library/rJava/libs/x64/rJava.dll’::
      LoadLibrary failure:  %1 不是有效的 Win32 应用程序。
    
    Error : package 'rJava' could not be loaded
    错误: 载入失败
    停止执行
    ERROR: loading failed for 'x64'
    * removing 'C:/Program Files/R/R-3.2.3/library/Rwordseg'
    * restoring previous 'C:/Program Files/R/R-3.2.3/library/Rwordseg'
    Warning in install.packages :
      running command '"C:/PROGRA~1/R/R-32~1.3/bin/i386/R" CMD INSTALL -l "C:\Program Files\R\R-3.2.3\library" C:\Users\amandage\AppData\Local\Temp\RtmpcXQKVE/downloaded_packages/Rwordseg_0.2-1.tar.gz' had status 1
    Warning in install.packages :
      installation of package ‘Rwordseg’ had non-zero exit status
    
    The downloaded source packages are in
    	‘C:\Users\*****\AppData\Local\Temp\RtmpcXQKVE\downloaded_packages’
    

     博主就是这样,一直安装一直在这里个问题上纠结,直到最后还是没有解决。

       BUT, 梦想还是要有的,万一实现了呢。

       我们换种方法来安装该包,不使用R软件里面的 install.packages()安装,而是使用本地加载的方式。

         回归正题:那么如何本地加载呢? (1)去https://r-forge.r-project.org/R/?group_id=1054这个网站下载Rwordseg包

      如上图所示,windos就下载红圈里边的那个就可以咯。

       那么下载下来之后,如何本地加载呢?

       所谓的本地加载就是在你的电脑上R中加载进去,首先打开你的电脑中得到R不是Rstudio,是R 在上面菜单栏里面的

       

       这个界面大家熟悉吧,哈哈,点击程序包,然后选择

       

       选择你下在的那个包,接着就等着一切大工搞成吧。

    --------------------------------------------------------- 我是分割线------------------------------------

    备注:由于我对操作系统不是很熟悉,所以安装包会下载成 Linux下面的。

             所以也会导致出现一系列的问题。不过好在一切都解决了。

    上述的安装方法绝对傻瓜式的,如果按照步骤还安装不好的,那么我就想静静了。。。。。

  • 相关阅读:
    冒泡排序
    希尔排序
    现实中遇到的业务状况记录
    OneZero第二周第二次站立会议(2016.3.29)
    OneZero第二周第一次站立会议(2016.3.28)
    OneZero第五次站立会议(2016.3.25)
    OneZero第四次站立会议(2016.3.24)
    PSP(3.16——3.22)以及周记录
    OneZero第三次站立会议(2016.3.23)
    读“软工实践总结作业”有感
  • 原文地址:https://www.cnblogs.com/goodge/p/5126396.html
Copyright © 2011-2022 走看看