我正在运行 Debian squeeze 和 perl v5.10.1,并且安装了两个版本的 python:
$ pyversions -i
python2.5 python2.6
Python::Inline
显然使用python2.5:
$ perl
use Inline::Python;
Inline::Python::py_eval('import sys');
Inline::Python::py_eval('print sys.version');
2.5.5 (r255:77872, Nov 28 2010, 17:10:16)
[GCC 4.4.5]
我需要 python2.6 来运行我的 python 代码。我怎样才能做到这一点?
您可以在安装模块期间链接到所需的版本。看生成文件.PL http://cpansearch.perl.org/src/NINE/Inline-Python-0.42/Makefile.PL:
#============================================================================
# What python are we going to try?
#============================================================================
my @pythons;
my $sep = $^O eq 'MSWin32' ? ";" : ":";
for $p (split /$sep/, $ENV{PATH}) {
$p =~ s/^~/$ENV{HOME}/;
$p .= "/python";
push @pythons, { path => $p } if -f $p && -x $p;
}
# Keep them in PATH order.
#@pythons = sort { $a->{path} cmp $b->{path} } @pythons;
my $num = 1;
print "Found these python executables on your PATH:\n";
print $num++ . ". " . $_->{path} . "\n" for @pythons;
my $sel = prompt("Use which?", '1');
$sel = $pythons[$sel-1] if $sel =~ /^\d+$/;
$sel = { path => $sel } unless ref $sel eq 'HASH';
print "Using $sel->{path}\n";
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)