更新时间:2023-01-23 17:54:32
已编译的模块可由python访问.为此,您应该将模块放入python路径中,或者需要将模块的位置添加到PYTHONPATH
环境变量中.
The compiled module could be accessible by python. To achieve that you should put the module into python path or you need to add the location of the module to PYTHONPATH
environment variable.
要查看python安装路径,可以将以下这些行写到python shell:
To see the python installations paths you can write these lines to python shell:
import sys
for path in sys.path:
print(path)
代码将显示python正在寻找模块的路径.
The code will show the paths python is looking for modules.
编译c库之后,您需要转到上层文件夹并按照安装页面中的说明运行python setup.py install
.这会将python模块放入您的python路径之一.
After you compile the c library, you need to go to upper folder and run python setup.py install
as it's said in the installation page. This will put python modules into one of your python paths.