在Google Colab上找不到程序:“pypy”。解决方案还是替代方案?

2024-05-15 02:58:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我在google colab笔记本上发现了这个错误。我是否需要安装一些东西,或者在colab中无法使用pypy?我尝试过这个简单的脚本:

%%pypy
print("hello")

# Couldn't find program: 'pypy'

如果我运行%lsmagic,则输出如下,其中存在pypy

Available line magics:
%alias  %alias_magic  %autocall  %automagic  %autosave  %bookmark  %cat  %cd  %clear  %colors  %config  %connect_info  %cp  %debug  %dhist  %dirs  %doctest_mode  %ed  %edit  %env  %gui  %hist  %history  %killbgscripts  %ldir  %less  %lf  %lk  %ll  %load  %load_ext  %loadpy  %logoff  %logon  %logstart  %logstate  %logstop  %ls  %lsmagic  %lx  %macro  %magic  %man  %matplotlib  %mkdir  %more  %mv  %notebook  %page  %pastebin  %pdb  %pdef  %pdoc  %pfile  %pinfo  %pinfo2  %pip  %popd  %pprint  %precision  %profile  %prun  %psearch  %psource  %pushd  %pwd  %pycat  %pylab  %qtconsole  %quickref  %recall  %rehashx  %reload_ext  %rep  %rerun  %reset  %reset_selective  %rm  %rmdir  %run  %save  %sc  %set_env  %shell  %store  %sx  %system  %tb  %tensorflow_version  %time  %timeit  %unalias  %unload_ext  %who  %who_ls  %whos  %xdel  %xmode

Available cell magics:
%%!  %%HTML  %%SVG  %%bash  %%bigquery  %%capture  %%debug  %%file  %%html  %%javascript  %%js  %%latex  %%perl  %%prun  %%pypy  %%python  %%python2  %%python3  %%ruby  %%script  %%sh  %%shell  %%svg  %%sx  %%system  %%time  %%timeit  %%writefile

Automagic is ON, % prefix IS NOT needed for line magics.

最终会有其他选择吗?我已经尝试过numba,但由于主要需要它来预处理数据,我通常需要OBEJCT,这似乎使numba无法在nopython模式下编译。所以我在寻找更灵活的东西,比如pypy


Tags: debugenvmagiclineloadaliaspypyls

热门问题