如何在无法联网的情况下用本地文件安装‘stringi’可以参考https://stackoverflow.com/questions/31942322/how-to-install-stringi-from-local-file-absolutely-no-internet-access
下载| stringi_1.7.6.tar.gz |
上传到/path/miniconda3/envs/R-4.1.3/lib/R/library
R CMD INSTALL stringi_1.7.6.tar.gz
❌报错①:
ERROR: failed to lock directory ‘/path/miniconda3/envs/R-4.1.3/lib/R/library’ for modifying
Try removing ‘/path/miniconda3/envs/R-4.1.3/lib/R/library/00LOCK-stringi’
出于防止其他安装过程干扰和暂存旧版本的目的,R在安装package时会先建立并锁定一个叫00LOCK-X的临时文件夹。安装完毕后如果由于某种原因该临时文件夹没有被删除的话,下次更新可能会因为锁定失败而终止。
✅解决方案①:
直接删除00LOCK-stringi
rm -r /path/miniconda3/envs/R-4.1.3/lib/R/library/00LOCK-stringi
再次运行R CMD INSTALL stringi_1.7.6.tar.gz
❌报错②:
checking whether the C++ compiler supports the long long type... no
*** *********************************************************************
*** stringi cannot be built with these settings in place.
*** See the INSTALL file for the solutions to the most common problems.
*** Moreover, explore the list of open and closed issues at
*** https://github.com/gagolews/stringi/issues/
*** *********************************************************************
ERROR: configuration failed for package ‘stringi’
我的R版本是4.1.3,gcc版本是9.3.0,不明白为什么报错......
✅解决方案②:
根据https://github.com/gagolews/stringi/issues/452
https://github.com/gagolews/stringi/issues/452
修改/path/miniconda3/envs/R-4.1.3/lib/R/etc/Makeconf
将CXX = x86_64-conda-linux-gnu-c++ -std=gnu++11
改为
CXX = x86_64-conda-linux-gnu-c++ -std=c++11
tar xf stringi_1.7.6.tar.gz
chmod -R 755 stringi
R CMD INSTALL stringi
❌报错③:
* installing to library ‘/path/miniconda3/envs/R-4.1.3/lib/R/library’
ERROR: cannot install to srcdir for package ‘stringi’
* removing ‘/path/miniconda3/envs/R-4.1.3/lib/R/library/stringi’
✅解决方案③:
conda install -c conda-forge r-stringi
library载入stringi没有报错,安装成功!
网友评论