由于在不断学习,所以这个博文也会不断进行更新
1. 安装与配置
安装anaconda,感觉带不带Navigator无所谓,因为到现在都是用vs code写代码,然后命令行运行
安装anaconda后,配一下你想要的python环境,最好最新吧,我用的是python 3.7,-n表示一个名字
conda create -n py37 python=3.7
然后命令行激活环境,使用
source activate py37
进入环境之后安装tensorflow 和 keras只需要两句话
pip install tensorflow
pip install keras
2.一些bug
可能运行代码会报错,
我目前遇到了以下几种问题:
1. 表示缺少某个依赖,那你就进入环境之后pip安装就可以了
2.使用plt时,无法正常跳图
ImportError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.
matplotlib.use('TkAgg')
这貌似只是一个临时办法,似乎anaconda安装的依赖环境总是缺一些东西
另一个一劳永逸的办法是找到你anaconda对应的环境中的matplotlib,在配置文件matplotlibrc中添加backend: TkAgg即可
这样就不用每一次都要改代码了
3. 还有一个
OMP: Error #15: Initializing libiomp5.dylib, but found libiomp5.dylib already initialized.
这个解决方法是
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
这个问题似乎只会在mac上出现,另外一个解决方案是 conda install nomkl
但这会安装几十m的依赖,我感觉似乎只和scipy有关,如果你们遇到了可以 conda install scipy试试