简体   繁体   English

从 python 到 pypy

[英]Shifting from python to pypy

I am currently working on a project where the source files are all written in python.我目前正在做一个项目,其中的源文件都是用 python 编写的。 The files/modules are currently being run on a python interpreter(CPython).文件/模块当前正在 python 解释器 (CPython) 上运行。 I want to use PyPy interpreter instead as i see it is much more efficient.我想改用 PyPy 解释器,因为我认为它效率更高。 Is there way how I can change the interpreter from the CMakeLists.txt file so the build process takes in PyPy interpreter instead of the python default interpreter?有没有办法从 CMakeLists.txt 文件中更改解释器,以便构建过程采用 PyPy 解释器而不是 python 默认解释器? I have a project named P and it contains a CMakeLists.txt file.我有一个名为 P 的项目,它包含一个 CMakeLists.txt 文件。

When it needs python interpreter, CMakeLists.txt usually uses find_package(PythonInterp) , which searches python executable and sets PYTHON_EXECUTABLE to the path where it is located.当需要 python 解释器时, CMakeLists.txt通常使用find_package(PythonInterp) ,它搜索 python 可执行文件并将PYTHON_EXECUTABLE设置为PYTHON_EXECUTABLE在的路径。

You may set this cache variable when call cmake :您可以在调用cmake时设置此缓存变量:

cmake -DPYTHON_EXECUTABLE=<path-to-PyPy> ...

so it will not search executable but use one you provide.所以它不会搜索可执行文件,而是使用您提供的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM