首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >R:使Ryacas包在Windows上运行时出现问题

R:使Ryacas包在Windows上运行时出现问题
EN

Stack Overflow用户
提问于 2012-01-10 04:17:05
回答 2查看 1.7K关注 0票数 4

我正在尝试使用R中的Ryacas包。下面是正在发生的事情:

代码语言:javascript
复制
> install.packages("Ryacas")
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://www.stats.bris.ac.uk/R/bin/windows/contrib/2.14/Ryacas_0.2-11.zip'
Content type 'application/zip' length 263424 bytes (257 Kb)
opened URL
downloaded 257 Kb

package ‘Ryacas’ successfully unpacked and MD5 sums checked

The downloaded packages are in
    C:\Documents and Settings\yogcal\Local Settings\Temp\RtmpKeuu7m\downloaded_packages

然后我尝试加载Ryacas

代码语言:javascript
复制
> library(Ryacas)
Loading required package: XML
C:\Program Files\R\R-2.14.1\library\Ryacas\yacdir\yacas.exe 
   or C:\Program Files\R\R-2.14.1\library\Ryacas\yacdir\scripts.dat 
 not found.
Run yacasInstall() without arguments to install yacas.

然后我运行yacasInstall()

代码语言:javascript
复制
> yacasInstall()
trying URL 'http://ryacas.googlecode.com/files/yacas-1.0.63.zip'
Content type 'application/x-zip' length 746009 bytes (728 Kb)
opened URL
downloaded 728 Kb

然后,当我尝试一个示例时:

代码语言:javascript
复制
> library(Ryacas)
> yacas("TeXForm(3 * x^2/(2 * (x + 1)) - (x^3) * 2/(2 * (x + 1))^2)", 
+  retclass = "unquote")
[1] "Starting Yacas!"
Error in socketConnection(host = "127.0.0.1", port = 9734, server = FALSE,  : 
  cannot open the connection
In addition: Warning message:
In socketConnection(host = "127.0.0.1", port = 9734, server = FALSE,  :
  127.0.0.1:9734 cannot be opened
> 

这里出了什么问题?

非常感谢。

EN

回答 2

Stack Overflow用户

发布于 2012-01-10 04:20:24

两种可能性: 1) Yacas从来没有开始过。(R不会为您加载Yacas。) 2)连接被阻塞。假设您从操作系统启动了Yacas,那么您需要使用安全管理工具打开该端口。这不是R问题,而是操作系统/防火墙问题。

关于需要从开始菜单启动Yacas,我可能是错的。这是以下代码:

代码语言:javascript
复制
runYacas()
### You should not need to type any of what follows. Just use the command above.
runYacas <- function(method = "system", yacas.args = "", yacas.init = "") {
   cmd <- yacasInvokeString(method = method, yacas.args = yacas.args, yacas.init = yacas.init)
   if (.Platform$OS.type == "windows") 
      system(cmd, wait = FALSE, invisible = FALSE)
   else system(cmd, wait = FALSE)
}

因为它似乎在调用系统,所以我会在R提示符下尝试。

票数 0
EN

Stack Overflow用户

发布于 2012-02-07 06:27:27

解决问题的一种方法是确保端口是打开的:

1)点击Windows Start

2)点击All Programs

3)点击Accessories

4)点击Command Prompt,打开DOS窗口

5)输入cd C:\Program Files\yacas\winrel,将目录更改为yacas.exe所在的目录(可能是C:\Program Files\yacas\winrel

6)通过输入yacas --server 9734启动服务器上的yacas

7) Yacas应该给你以下的反馈Accepting requests from port 9734

如果到目前为止一切正常,那么yacas正在运行并准备好对话。现在,你可以运行你的R代码了。如果它不工作,那么您的yacas就有问题了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8794614

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档