什么是关于Python和CPython (Jython,IronPython)的所有这些大惊小怪,我不明白:
python.org提到CPython是:
Python的"传统"实现(绰号CPython)
CPython是Python的默认字节码解释器,用C语言编写.
老实说,我没有得到这两个解释实际上意味着什么,但我认为,如果我使用CPython,这意味着当我运行示例python代码时,它将它编译为C语言,然后执行它就好像它是C码
那么CPython究竟是什么呢?与python相比它有何不同?我是否应该使用CPython而不是Python,如果有的话,它有什么优势呢?
我知道Python主要比fortran和c / c ++等语言慢,因为它是解释而不是编译的。
我也读过的另一个原因是它很慢,因为它是动态类型的,即您不必声明变量类型,而是自动声明它。这非常好,因为它使代码看起来更简洁,而且您基本上不必太担心变量类型。
我知道这样做的理由不是很好,因为您可以包装例如。使用Python编写的fortran代码,但是是否可以手动覆盖Python的这种动态类型化性质并手动声明所有变量类型,从而提高Python的速度?
截至 2020 年,可以使用 pypy 安装 scipy。(pypy下可以安装scipy吗?)
\n\npypy3 -mpip install scipy\nRun Code Online (Sandbox Code Playgroud)\n\n然而,轮子因这种错误而失败:
\n\n error: Command "g++ -pthread -DNDEBUG -O2 -fPIC -I/tmp/pip-build-env-lfdsn__t/overlay/site-packages/numpy/core/include -I/usr/lib/pypy3/include -c scipy/_lib/_uarray/_uarray_dispatch.cxx -o build/temp.linux-x86_64-3.6/scipy/_lib/_uarray/_uarray_dispatch.o -MMD -MF build/temp.linux-x86_64-3.6/scipy/_lib/_uarray/_uarray_dispatch.o.d -std=c++14 -fvisibility=hidden" failed with exit status 1\n\n\n ERROR: Failed building wheel for scipy\nRun Code Online (Sandbox Code Playgroud)\n\n无法构建 scipy\n错误:无法为使用 PEP 517 的 scipy 构建轮子,并且无法直接安装
\n\n使用 --no-use-pep517 选项给出类似的结果:
\n\n error: Command "g++ -pthread -DNDEBUG -O2 -fPIC -I/home/ezako/.local/lib/pypy3.6/site-packages/numpy/core/include -I/usr/lib/pypy3/include -c scipy/_lib/_uarray/_uarray_dispatch.cxx -o build/temp.linux-x86_64-3.6/scipy/_lib/_uarray/_uarray_dispatch.o -MMD -MF build/temp.linux-x86_64-3.6/scipy/_lib/_uarray/_uarray_dispatch.o.d -std=c++14 -fvisibility=hidden" failed with exit status …Run Code Online (Sandbox Code Playgroud)