2017-04-25 58 views
1

我在安裝Github的blotter和quantstrat軟件包時遇到困難。當我們在網上找到的大部分幫助都是在Sourceforge上託管時發佈的。我嘗試使用install_github()函數,它返回下面的錯誤。 (事實上​​,當我嘗試R-Forge時也有類似的錯誤)任何人都可以提供關於這裏發生的事情的線索嗎?安裝幷包含在PATH變量在GitHub上安裝blotter和quantstrat

install_github("braverock/blotter") 
Downloading GitHub repo braverock/[email protected] 
from URL https://api.github.com/repos/braverock/blotter/zipball/master 
Installing blotter 
"C:/PROGRA~1/R/R-33~1.3/bin/x64/R" --no-site-file --no-environ --no-save \ 
    --no-restore --quiet CMD INSTALL \ 
    "C:/Users/User/AppData/Local/Temp/Rtmp8mMwyT/devtools416cfd229e7/braverock-blotter-bdefb02" \ 
    --library="C:/Program Files/R/R-3.3.3/library" --install-tests 

* installing *source* package 'blotter' ... 
** libs 

*** arch - i386 
c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-33~1.3/include" -DNDEBUG  -I"d:/Compiler/gcc-4.9.3/local330/include"  -O3 -Wall -std=gnu99 -mtune=core2 -c calcPosAvgCost.c -o calcPosAvgCost.o 
make: sh.exe: Command not found 
make: *** [calcPosAvgCost.o] Error 127 
Warning: running command 'make -f "C:/PROGRA~1/R/R-33~1.3/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-33~1.3/share/make/winshlib.mk" SHLIB="blotter.dll" OBJECTS="calcPosAvgCost.o"' had status 2 
ERROR: compilation failed for package 'blotter' 
* removing 'C:/Program Files/R/R-3.3.3/library/blotter' 
Error: Command failed (1) 

Rtools:

  • C:\ RBuildTools \ 3.3 \ BIN
  • C:\ RBuildTools \ 3.3 \ GCC-4.6.3 \ bin中

會議信息:

R version 3.3.3 (2017-03-06) 
Platform: x86_64-w64-mingw32/x64 (64-bit) 
Running under: Windows 7 x64 (build 7601) Service Pack 1 

locale: 
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252 
[3] LC_MONETARY=English_United Kingdom.1252 
[4] LC_NUMERIC=C       
[5] LC_TIME=English_United Kingdom.1252  

attached base packages: 
[1] stats  graphics grDevices utils  datasets methods base  

other attached packages: 
[1] devtools_1.12.0 

loaded via a namespace (and not attached): 
[1] httr_1.1.0 R6_2.1.2  tools_3.3.3 withr_1.0.2 curl_2.3  
[6] memoise_1.0.0 git2r_0.14.0 digest_0.6.11 
+1

你能告訴我們'sh.exe'的位置嗎?它也看起來像在你的PATH變量是'c:\ RbuildTools'時搜索'c:\ Rtools'。它是否正確? – ricoderks

+0

它在C:\ RBuildTools \ 3.3 \ bin中。實際上我只是安裝了Rtools 3.3並卸載了Rtools 3.2(作爲將R版本升級到3.3.3的一部分),並且一些舊的Rtools文件仍然存在於c:\ RbuildTools中。但我已經改變了PATH變量來引用新的目錄(並刪除了舊目錄)。我還需要改變什麼嗎? – user90957

+0

更新:我刪除舊的Rtools目錄後,它工作。非常感謝@ricoderks爲我指出正確的方向。對於任何可能到達此處的用戶,還需要安裝install_github(「joshuaulrich/xts」)的xts 0.10.0版。 – user90957

回答

10

試試這個:

install.packages("devtools") 
require(devtools) 
install_github("braverock/FinancialInstrument") 
install_github("joshuaulrich/xts") 
install_github("braverock/blotter") 
install_github("braverock/quantstrat") 
install_github("braverock/PerformanceAnalytics") 
+0

上述命令保存我的一天。 –