Reputation: 1862
I installed perl with brew then I found that when I type perl -v
it says 5.18.1
but when I type in which perl
it says /usr/local/bin/perl
and if I type /usr/local/bin/perl -v
it says 5.28.1
which I believe is the brew version. The problem now is that I can run some perl script in terminal without problem (5.18.1) but run in python by calling subprocess, it will call 5.28.1 version which causes the script to fail. Any idea how I can use 5.18.1 inside the subprocess?
Upvotes: 1
Views: 480
Reputation: 118595
Then see this question and this question for an explanation of hashed commands. Perhaps you edited your PATH
after your shell had already made a hash entry for the perl
command.
You can delete the hash entry with
hash -d perl
And then perl
should resolve to the same location returned by which perl
.
To remove all hashed commands, say, after you update the PATH
variable, the command is
hash -r
Upvotes: 2