[Rd] Robust, platform independent method to check for python

Gabor Grothendieck ggrothendieck at gmail.com
Sat Jun 27 18:01:34 CEST 2009


If you can assume its on your path then try this:

pth <- sapply(strsplit(Sys.getenv("PATH"), ";"), function(x)
file.path(x, "python.exe", fsep = "\\"))
pth[file.exists(pth)][1]

On Sat, Jun 27, 2009 at 11:44 AM, Carlos J. Gil
Bellosta<cgb at datanalytics.com> wrote:
> Hello,
>
> I have been unsuccessfully struggling for a programmatical method to
> find out whether and where Python is installed.
>
> The reason is that I am developing a package that depends on python.
>
> On UNIX/UNIX-like systems I can quite safely assume that python is
> directly callable via system if installed.
>
> My main problems is Windows, though...
>
> Has anybody faced this problem before?
>
> Best regards,
>
> Carlos J. Gil Bellosta
> http://www.datanalytics.com
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



More information about the R-devel mailing list