1: ubuntu安装pypy
sudo add-apt-repository ppa:pypy/ppa
sudo apt-get update
sudo apt-get install pypy pypy-dev
2:编译安装
参考:https://pypy.readthedocs.io/en/latest/build.html
在ubuntu中尝试没有成功,原因未知
3: 使用conda安装
miniconda下载: https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/
anaconda下载:https://mirror.tuna.tsinghua.edu.cn/help/anaconda/
conda create -n mine_pypy pypy3.9 -c https://conda.anaconda.org/conda-forge
在官方的镜像仓库https://conda.anaconda.org/搜索包(假定包名为PyPy)的相关信息
anaconda search -t conda PyPy
pypy -m ensurepip
pypy -mpip install -U pip wheel # 确保pip是最新版本
pypy -mpip install 要安装的包名 # pypy -mpip install pygments
测试
import time
t = time.time()
for i in xrange(10**8):
continue
print time.time() - t
参考:https://blog.csdn.net/weixin_45827423/article/details/122400313