通过 Python 代码使用 F2Py
如何通过Python使用F2Py
而不是在命令行中调用它?
我正在使用 便携式 Python,但无法安装 Python。因此,如果我解压缩包并将所有内容复制到文件夹“site-packages”中,则无法安装除那些工作之外的包。提到这些,也无法更改环境变量,即path
(无法更改,附加;),尽管不可能以简短形式调用命令“F2Py”。
虽然 F2Py
是 numpy 的一部分,并且 numpy 安装在可移植的 Python 中,但任何地方都没有安装“F2Py.py”。
问题是如何使用F2Py
编译Python中使用的Fortran代码,考虑到访问限制等?
请注意,文件夹中解压有一个 GFortran
二进制文件。
How to use F2Py
through Python instead of calling it in command line?
I have a portable Python in use, am not able to install Python. Thus it is not possible to install packages except those work if I unzip the package and copy all to the folder 'site-packages'. Having these mentioned, it is also impossible to change environmental variables, i.e., path
(cannot be changed, appended;) though it is not possible to call commands 'F2Py' in short form.
Although F2Py
is part of numpy and numpy is installed in the portable Python, there is no 'F2Py.py' installed anywhere.
The question is how to use F2Py
to compile Fortran code being used in Python considering the access limtation etc?
Note that there is a GFortran
binary unpacked in a folder.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然我不太明白你的解释,但从第一句话来看,你想要做的似乎是在 python 中获得与
f2py -c -m hello hello.f
等效的内容:Although I don't really understand your explanation, from the first sentence it would seem that what you want to do is to get the equivalent of
f2py -c -m hello hello.f
in python: