我知道如何使用cx_freeze将CPython文件编译为exe,但是可以使用PyPy编译一个简单的程序到Exe吗?
从我在博客上看到和阅读的内容来看,PyPy是一个非常雄心勃勃的项目.它将为其兄弟姐妹(CPython,Jython和IronPython)带来哪些优势?它是速度,跨平台兼容性(包括移动平台),在没有GIL的情况下使用c扩展的能力,还是更多关于可以做什么的技术练习?
我有ubuntu 11.10.我从这个启动板存储库中安装了pypy:https://launchpad.net/~pypy 计算机上已经有python,而python有自己的pip.如何为pypy安装pip,如何以不同于python的方式使用它?
运行以下命令
virtualenv -p /usr/local/bin/pypy pypy
Run Code Online (Sandbox Code Playgroud)
退出时出错
Running virtualenv with interpreter /usr/local/bin/pypy
New pypy executable in pypy/bin/pypy
debug: WARNING: Library path not found, using compiled-in sys.path.
debug: WARNING: 'sys.prefix' will not be set.
debug: WARNING: Make sure the pypy binary is kept inside its tree of files.
debug: WARNING: It is ok to create a symlink to it from somewhere else.
'import site' failed
AttributeError: 'module' object has no attribute 'prefix'
ERROR: The executable pypy/bin/pypy is not functioning
ERROR: It thinks …
Run Code Online (Sandbox Code Playgroud) 如何在pypy解释器而不是cpython解释器上使用ipython?ipython网站只是说它有效,但很少有关于如何做到这一点的细节.
(或者,"可以使用PyPy/RPython将Python编译/转换为C/C++ 而不需要Python运行时吗?")
我试图通过它的RPython及其Python,它的运行和编译以及它的翻译来理解PyPy,并且有些失败.
我有一个假设的Python项目(适用于Windows); 我想保持它的大小,大约100千字节(ONO),而不是使用py2exe所需的几兆字节(在UPX之后).我可以以任何方式使用PyPy 1来生成不依赖于Python26.dll的独立可执行文件吗?如果可以的话,它是否需要遵循RPython限制,例如for
只处理内置类型,还是完整的Python语法?
我确实意识到,如果可以做到这一点,我几乎肯定不能直接使用Python的C模块.
1 (自提问时起,情况变得更加清晰,工具链的这一部分更明确地被称为RPython而不是PyPy; 2010年情况并非如此.)
Julia是一种新的统计编程语言,其声称性能明显优于竞争语言.我正试图验证这一点.Julia有一个用Python编写的性能测试:https: //github.com/JuliaLang/julia/blob/master/test/perf/perf.py
我不能让它与pypy一起工作.也许这是因为numpypy与numpy不兼容,但我还没有达到足够的程度来确定这一点.我按照ImportError建议,"...or just write 'import numpypy' first in your program..."
但我得到另一个ImportError:"No module named numpy.linalg"
我对Python几乎没有经验,我正在寻找一个可以运行的完整解决方案.让它发挥作用的好处是我们可以进行一对一(jit lang-to-jit lang)比较.
我在Win10上尝试了pythonnet和pypy.它构建良好,但然后无法导入clr.在屏幕截图中的此调用之后发生崩溃.
调试这个的任何提示/工具?
pypy
Python 2.7.12 (aff251e54385, Nov 09 2016, 17:54:55)
[PyPy 5.6.0 with MSC v.1500 32 bit] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>> import clr
Attempting to load 'Python.Runtime' using standard binding rules.
'Python.Runtime' not found using standard binding rules.
Attempting to load Python.Runtime from: 'C:\Python\pypy2-v5.6.0-win32\site-packages\Python.Runtime.dll'.
Success loading 'Python.Runtime' from: 'C:\Python\pypy2-v5.6.0-win32\site-packages\Python.Runtime.dll'.
RPython traceback:
File "pypy_module_cpyext_2.c", line 26114, in type_realize
File "pypy_module_cpyext_2.c", line 31744, in _type_realize
Fatal RPython error: AssertionError
This application has requested the …
Run Code Online (Sandbox Code Playgroud) 我正在尝试优化Reed-Solomon编码器,这实际上只是对Galois Fields 2 ^ 8的多项式除法运算(这意味着值环绕超过255).事实上,代码与Go中的代码非常相似:http://research.swtch.com/field
这里使用的多项式除法算法是合成除法(也称为Horner方法).
我尝试了一切:numpy,pypy,cython.我得到的最佳性能是使用pypy和这个简单的嵌套循环:
def rsenc(msg_in, nsym, gen):
'''Reed-Solomon encoding using polynomial division, better explained at http://research.swtch.com/field'''
msg_out = bytearray(msg_in) + bytearray(len(gen)-1)
lgen = bytearray([gf_log[gen[j]] for j in xrange(len(gen))])
for i in xrange(len(msg_in)):
coef = msg_out[i]
# coef = gf_mul(msg_out[i], gf_inverse(gen[0])) // for general polynomial division (when polynomials are non-monic), we need to compute: coef = msg_out[i] / gen[0]
if coef != 0: # coef 0 is normally undefined so we manage …
Run Code Online (Sandbox Code Playgroud) 我现在正在ubuntu 15.10上使用Python
但在我的操作系统中,我安装了许多不同的python版本:
所以,我对他们的包环境版本感到很乱,例如,如果我运行:
pip3 install django
Run Code Online (Sandbox Code Playgroud)
实际上我不能在里面导入django python3.5
.
有没有有效的方法来调用相关版本pip
?
PS:不建议我使用virtualenv,我知道它并正在寻求另一种解决方案.
pypy ×10
python ×10
numpy ×2
pip ×2
.net ×1
compilation ×1
cython ×1
exec ×1
interpreter ×1
ipython ×1
julia ×1
optimization ×1
pypi ×1
python-2.7 ×1
python-3.x ×1
python.net ×1
rpython ×1
translate ×1
ubuntu ×1
virtualenv ×1
windows ×1