pypy

Can PyPy/RPython be used to produce a small standalone executable?

怎甘沉沦 提交于 2019-12-03 04:51:51
问题 (Or, "Can PyPy/RPython be used to compile/translate Python to C/C++ without requiring the Python runtime ?") I have tried to comprehend PyPy with its RPython and its Python, its running and its compiling and its translating, and have somewhat failed. I have a hypothetical Python project (for Windows); I would like to keep its size down, in the order of a hundred kilobytes (O.N.O.) rather than the several megabytes that using py2exe entails (after UPX). Can I use PyPy 1 in any way to produce a

設置一個支持多種版本的 Python 環境

风格不统一 提交于 2019-12-03 03:20:01
起因 爲了以下目的才有了本文: 學習 Python 3 。 使系統 Python 環境不再受污染。 前提 配置過程中需要用到以下軟件: Python 2.7.3 ( 通過 python -V 確認 ) pip ( 通過 pip help 確認 ) curl ( 通過 curl --help 確認 ) libsqlite3-dev ( 可選,若要 Python 支持 sqlite3 ,請先安裝 sudo apt-get instll libsqlite3-dev ) libssl-dev (可選,若要 Python 支持 ssl , 請先安裝 sudo apt-get install libssl-dev ) 若未安裝請參考 Google 安裝後繼續。 安裝 Pythonz Pythonz 可以讓用戶在 $home 目錄下通過源碼自動構建和安裝多種版本的 Python ,其源自 pythonbrew 。個人覺得 Pythonz 功能簡單就幫你安裝各種版本的 Python ,至少目前是這樣。 安裝步驟如下: # 默認安裝在 ~/.pythonz 下 curl -kL https://raw.github.com/saghul/pythonz/master/pythonz-install | bash # 配置 ~/.zshrc ( zsh用戶,就像我 ) 或 ~/.bashrc (

Is it possible to run a pypy kernel in the Jupyter notebook?

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have always wondered if it were possible to run PyPy in the Jupyter notebook. I recently tried installing PyPy on my local machine, and it ran really well - 100X speedup in an agent-based simulation written in pure Python. However, I miss the interactivity in the Jupyter notebook. Is it possible to make the IPython kernel use PyPy rather than CPython? 回答1: You can install Jupyter with pypy: pypy-pip install jupyter The are problems on Mac OS X. If the install fails complaining a about gnureadline . Try this: pypy-pip install --no-deps

What does PyPy have to offer over CPython, Jython, and IronPython?

百般思念 提交于 2019-12-03 02:42:37
问题 From what I have seen and read on blogs, PyPy is a very ambitious project. What are some advantages it will bring to the table over its siblings (CPython, Jython, and IronPython)? Is it speed, cross-platform compatibility (including mobile platforms), the ability to use c-extensions without the GIL, or is this more of a technical exercise on what can be done? 回答1: PyPy is really two projects: An interpreter compiler toolchain allowing you to write interpreters in RPython (a static subset of

Why is cffi so much quicker than numpy?

限于喜欢 提交于 2019-12-03 02:16:58
I have been playing around with writing cffi modules in python, and their speed is making me wonder if I'm using standard python correctly. It's making me want to switch to C completely! Truthfully there are some great python libraries I could never reimplement myself in C so this is more hypothetical than anything really. This example shows the sum function in python being used with a numpy array, and how slow it is in comparison with a c function. Is there a quicker pythonic way of computing the sum of a numpy array? def cast_matrix(matrix, ffi): ap = ffi.new("double* [%d]" % (matrix.shape[0

pypy memory usage grows forever?

不羁的心 提交于 2019-12-03 02:08:00
I have a complicated python server app, that runs constantly all the time. Below is a very simplified version of it. When I run the below app using python; "python Main.py". It uses 8mb of ram straight away, and stays at 8mb of ram, as it should. When I run it using pypy "pypy Main.py". It begins by using 22mb of ram and over time the ram usage grows. After a 30 seconds its at 50mb, after an hour its at 60mb. If I change the "b.something()" to be "pass" it doesn't gobble up memory like that. I'm using pypy 1.9 on OSX 10.7.4 I'm okay with pypy using more ram than python. Is there a way to stop

Use Sympy with Pypy

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have installed Python 2.7 and 3.5 on a Mac running with El Capitan. Moreover, I use the package Sympy (installed with pip) with python. I wanted to run my code with Pypy (installed with homebrew) but it seems that Pypy doesn't find Sympy and says: "No module named sympy" I am not an expert at all and don't know what to do now. Sympy works well with python 2 and 3 but not with Pypy. I appreciate every answer, thank you in advance. 回答1: PyPy packages are separate from Python packages. You can install SymPy into PyPy with pypy -m pip install

Can PyPy/RPython be used to produce a small standalone executable?

倖福魔咒の 提交于 2019-12-02 18:06:23
(Or, "Can PyPy/RPython be used to compile/translate Python to C/C++ without requiring the Python runtime ?") I have tried to comprehend PyPy with its RPython and its Python, its running and its compiling and its translating, and have somewhat failed. I have a hypothetical Python project (for Windows); I would like to keep its size down, in the order of a hundred kilobytes (O.N.O.) rather than the several megabytes that using py2exe entails (after UPX). Can I use PyPy 1 in any way to produce a standalone executable which does not depend on Python26.dll? If I can, does it need to follow the

What does PyPy have to offer over CPython, Jython, and IronPython?

被刻印的时光 ゝ 提交于 2019-12-02 16:17:07
From what I have seen and read on blogs, PyPy is a very ambitious project. What are some advantages it will bring to the table over its siblings (CPython, Jython, and IronPython)? Is it speed, cross-platform compatibility (including mobile platforms), the ability to use c-extensions without the GIL, or is this more of a technical exercise on what can be done? PyPy is really two projects: An interpreter compiler toolchain allowing you to write interpreters in RPython (a static subset of Python) and have cross-platform interpreters compiled standalone, for the JVM, for .NET (etc) An

Why wasn't PyPy included in standard Python?

久未见 提交于 2019-12-02 13:55:28
I was looking at PyPy and I was just wondering why it hasn't been adopted into the mainline Python distributions. Wouldn't things like JIT compilation and lower memory footprint greatly improve the speeds of all Python code? In short, what are the main drawbacks of PyPy that cause it to remain a separate project? PyPy is not a fork of CPython, so it could never be merged directly into CPython. Theoretically the Python community could universally adopt PyPy, PyPy could be made the reference implementation, and CPython could be discontinued. However, PyPy has its own weaknesses: CPython is easy