val*_*eri 3 python jit pypy python-3.x google-colaboratory
我在 google colab 笔记本中收到此错误。我是否需要安装某些东西,或者无法在 colab 中使用 pypy?我尝试过这个简单的脚本:
%%pypy
print("hello")
# Couldn't find program: 'pypy'
Run Code Online (Sandbox Code Playgroud)
如果我运行%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.
Run Code Online (Sandbox Code Playgroud)
最终还有一些替代方案吗?我已经尝试过 numba,但由于主要需要它来预处理数据,我通常需要的对象似乎使 numba 无法在 nopython 模式下编译。所以我正在寻找像 pypy 这样更灵活的东西。
在 Colab 虚拟机上安装 pypy 后,您就可以在 Colab 中使用 pypy:
!apt-get install pypy
Run Code Online (Sandbox Code Playgroud)
%%pypy
import sys
print(sys.executable)
# /usr/bin/pypy
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1276 次 |
| 最近记录: |