Mac 下 Anaconda 安装 fealpy

16 篇文章 0 订阅
16 篇文章 0 订阅

主要记录用 Anaconda 安装 fealpy,既然要用 Anaconda 那么首先了解一下 Anaconda 到底是什么,可以参考 Anaconda 完全入门指南,以及熟悉一下 conda 的命令操作 (conda 常用命令) 可以帮助理解.


我自己比较喜欢把不同的事情分开管理,所以这里单独创建一个名为 myFealpyvirtual environment:

conda create -n myFealpy python=3

接下来就是安装 fealpy,完全按照 fealpy 中 Ubuntu 下的第 1, 2 步安装步骤:

  1. please install the python envieronment.
$ sudo apt install git            # The version control tool
$ sudo apt install python3        # The python3 interpretor 
$ sudo apt install python3-pip    # The PyPA recommended tool for installing Python packages.
$ sudo apt install python3-tk     # Python interface to Tcl/Tk used by matplotlib 
  1. clone the latest fealpy from github or gitlab:
$ git clone https://github.com/weihuayi/fealpy.git

(假定第1,2步已经完成, 主要是安装 fealpy 的依赖库)
这里需要注意一下, 在最新的版本中可以按照如下的方式来安装 fealpy 依赖库 (下面命令中 -c conda-forge 可以去掉, 但是最好不要去掉)

$ conda install -n myFealpy -c conda-forge meshio
$ conda install -n myFealpy -c conda-forge meshpy  
$ conda install -n myFealpy -c conda-forge pyamg
$ conda install -n myFealpy -c conda-forge pyfftw
$ conda install -n myFealpy -c conda-forge vtk
$ conda install -n myFealpy -c conda-forge mpi4py
$ conda install -n myFealpy -c conda-forge petsc
$ conda install -n myFealpy -c conda-forge petsc4py

然后我们看第3步,Ubuntucd fealpy/, 然后 sudo -H pip3 install -e ./,但是这里我们需要指定 pip 的位置(我的 Anaconda 直接装在了根目录下 /anaconda3 ):
(或者先 conda activate myFealpy 切换到 myFealpy 的 virtual env 下, 这样可以直接用 sudo -H pip install -e ./ 就可以了)

sudo -H /anaconda3/envs/myFealpy/bin/pip install -e ./

可以通过 conda info --envconda env list 来查看 ‘‘env’’ 的具体安装路径.

另外需要注意的一点是 fealpy 给出了两种安装命令

sudo -H /anaconda3/envs/myFealpy/bin/pip install -e ./
 和 
sudo -H /anaconda3/envs/myFealpy/bin/pip install ./

但是我只有在用 sudo -H /anaconda3/envs/myFealpy/bin/pip install -e ./ 安装时才能运行里面的 examples,而用 sudo -H /anaconda3/envs/myFealpy/bin/pip install ./ 安装后,运行时总是出错:No module named 'fealpy'.


另外想要运行多边形网格算例 (如 VEM 算例),需要安装 meshpy,参见 meshpy 官网给的说明

  1. Download MeshPy
  2. $ cd MeshPy-VERSION # if you're not there already
    $ ./configure
    $ python setup.py install

而我自己则利用下面命令安装

sudo /anaconda3/envs/myFealpy/bin/python3 setup.py  install

但是 macOS 下安装 meshpy 会出问题,具体问题以及解决方法见:Some meshpy installation issue on MacOS mojave 10.14

I think the installation guide for macOS is quite uncompleted?
Following the guide for Linux, changing the command to brew for most packages, I had the following error while installing meshpy by running pip install meshpy

   ld: library not found for -lstdc++
   clang: error: linker command failed with exit code 1 (use -v to see invocation)
   error: command 'g++' failed with exit status 1

This error can be caused by Xcode being not up-to-date, run xcode-select --install will do. Then run brew config to make sure CLT has a version.
After installing the CLT of Xcode, go to /Library/Developer/CommandLineTools/Packages/, execute the package there macOS_SDK_headers_for_macOS_10.14.pkg would add lstdc++ back to the header.
Now all the .ipynb files in doc can be run without an issue.


以及安装 pyfftwmyFealpy
sudo conda install -n myFealpy -c conda-forge pyfftw

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值