openpnm安装

发布于 2023-03-21  863 次阅读


Please refresh the page if equations are not rendered correctly.
---------------------------------------------------------------

OPENPNM安装及使用教程

安装

在openpnm官网上下载:https://openpnm.org/installation.html

安装分为标准版和开发版本

标准版

如果电脑上已安装Anaconda,那么直接在Anaconda命令行(Anaconda Promote)里输入:

conda install -c conda-forge openpnm

即可安装标准版,标准版可能会有某些功能无法使用,建议按照下面的方法安装开发版本

开发版本

如果想要安装开发版本则需要使用git,git的安装和初级使用教程可以参考:https://www.binyang.fun/git%e5%88%9d%e7%ba%a7%e6%95%99%e7%a8%8b%e4%b8%8a%e4%bc%a0%e5%b9%b6%e5%85%b1%e4%ba%ab%e6%96%87%e4%bb%b6/

注意

国内IP会出现github.com打不开或者git安装包无法下载的情况,解决办法如下:

1、打开C:\Windows\System32\drivers\etc,找到hosts文件,将其移动到桌面,用记事本打开

2、如果文件是空白的,则需要先复制下面这段话到文件里:

Copyright © 1993-1999 Microsoft Corp.

This file contains the mappings of IP addresses to host names. Each
entry should be kept on an individual line. The IP address should
be placed in the first column followed by the corresponding host name.

The IP address and the host name should be separated by at least one
space.

Additionally, comments (such as these) may be inserted on individual
lines or following the machine name denoted by a ‘#’ symbol.

For example:

102.54.94.97 rhino.acme.com # source server

38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost127.0.0.1 localhost127.0.0.1
localhost127.0.0.1 localhost

3、随后将以下内容复制粘贴至末尾:

20.205.243.166 github.com

# GitHub Start

140.82.114.4 github.com

199.232.69.194 github.global.ssl.fastly.net

# GitHub End

如果文件不是空白则直接复制上面这段话粘贴至末尾

最后保存,再把hosts文件移回原来的文件夹及可,如果hosts文件不是空白则跳过第二步

如果上述三步完成之后仍无法打开GitHub,则尝试下面的方法

打开hosts文件,删除其中所有文本,将下面这段文本复制粘贴至hosts文件内保存:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

然后打浏览器就可以进入网站了

开发版本安装步骤
1、win+r,输入cmd,打开命令行,进入安装git时创建的本地资源库目录,以我的创建目录为例,在命令行里输入

cd C:\Users\ALPHA\Desktop\testgit

2、克隆openpnm的数据库到本地数据库

git clone https://github.com/PMEAL/OpenPNM

此时可能会报错,报错信息为

fatal: unable to access https://github.com/PMEAL/OpenPNM
Connection was reset

解决办法为继续输入以下内容执行:

//取消http代理
git config --global --unset http.proxy
//取消https代理
git config --global --unset https.proxy

随后重新执行git clone操作即可

3、然后按照官方教程依次执行下面的命令就行
cd OpenPNM

conda install --file requirements/conda.txt -c conda-forge --override-channels

pip install --no-deps -e .

4、最后检查更新

git pull

安装完成

教程

https://openpnm.org/_examples/index.html
注意:不要看basic usage里的例子,这些例子对应的是V2版本的openpnm,在V3版本的openpnm里无法执行,有很多错误,想要学直接进上面的网址

Everything not saved will be lost.
最后更新于 2023-03-23