【问题标题】:Couldn't find program: 'pypy' on Google Colab. Solution or alternatives?在 Google Colab 上找不到程序:“pypy”。解决方案或替代方案?
【发布时间】:2020-07-26 15:54:19
【问题描述】:

我在 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 但由于大多数情况下需要它来预处理数据,我通常需要似乎使 numba 无法在 nopython 模式下编译的对象。所以我正在寻找更灵活的东西,比如 pypy。

【问题讨论】:

  • 最终还有其他选择吗?我已经尝试过 numba 但由于大多数情况下需要它来预处理数据,我通常需要似乎使 numba 无法在 nopython 模式下编译的对象。所以我正在寻找更灵活的东西,比如 pypy。 如果你正在尝试执行一些密集的任务,Colab 可能不是一个好的选择。

标签: python python-3.x google-colaboratory jit pypy


【解决方案1】:

在 Colab 虚拟机上安装 pypy 后,即可在 Colab 中使用它:

!apt-get install pypy
%%pypy
import sys
print(sys.executable)
# /usr/bin/pypy

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-06-04
    • 1970-01-01
    • 2023-03-23
    • 1970-01-01
    • 2020-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多