以下内容主要参考Pelican安装使用
在安装matplotlib==1.5.1时候,报错
#依赖库,写入到requirements.txt
Markdown
pelican
jupyter
ipython
nbconvert
beautifulsoup4
ghp-import
matplotlib
| => pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting Markdown==2.6.6 (from -r requirements.txt (line 1))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/14/eb/ae35c7d154eb9395c49950788e738effd0e2e8293544e8ee7558a369d7e8/Markdown-2.6.6.zip (412kB)
100% |████████████████████████████████| 419kB 3.4MB/s
Collecting pelican==3.6.3 (from -r requirements.txt (line 2))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d0/57/d6bba50602b6345ff992b543b904c82f5bac35d84c86949f742bb83dd61d/pelican-3.6.3-py2.py3-none-any.whl (130kB)
100% |████████████████████████████████| 133kB 7.4MB/s
Requirement already satisfied: jupyter>=1.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from -r requirements.txt (line 3)) (1.0.0)
Requirement already satisfied: ipython>=4.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from -r requirements.txt (line 4)) (6.2.1)
Requirement already satisfied: nbconvert>=4.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from -r requirements.txt (line 5)) (5.3.1)
Requirement already satisfied: beautifulsoup4 in /Users/micocube/Library/Python/3.6/lib/python/site-packages (from -r requirements.txt (line 6)) (4.6.0)
Collecting ghp-import==0.4.1 (from -r requirements.txt (line 7))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/08/17/9847c2be67ef5af9d10835610c59138b37229e0cb296899bdafb4dbd603d/ghp-import-0.4.1.tar.gz
Collecting matplotlib==1.5.1 (from -r requirements.txt (line 8))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/8f/f4/c0c7e81f64d5f4d36e52e393af687f28882c53dcd924419d684dc9859f40/matplotlib-1.5.1.tar.gz (54.0MB)
100% |████████████████████████████████| 54.0MB 538kB/s
Complete output from command python setup.py egg_info:
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.5.1]
python: yes [3.6.1 (v3.6.1:69c0db5050, Mar 21 2017,
01:21:04) [GCC 4.2.1 (Apple Inc. build 5666) (dot
3)]]
platform: yes [darwin]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.13.1]
dateutil: yes [using dateutil version 2.6.1]
pytz: yes [using pytz version 2017.2]
cycler: yes [using cycler version 0.10.0]
tornado: yes [using tornado version 4.5.1]
pyparsing: yes [using pyparsing version 2.2.0]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
freetype: no [The C/C++ header for freetype2 (ft2build.h)
could not be found. You may need to install the
development package.]
png: yes [version 1.6.34]
qhull: yes [pkg-config information for 'qhull' could not be
found. Using local copy.]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: yes [nose 0.11.1 or later is required to run the
matplotlib test suite. Please install it with pip or
your preferred tool to run the test suite / using
unittest.mock]
toolkits_tests: yes [nose 0.11.1 or later is required to run the
matplotlib test suite. Please install it with pip or
your preferred tool to run the test suite / using
unittest.mock]
OPTIONAL BACKEND EXTENSIONS
macosx: yes [installing, darwin]
qt5agg: no [PyQt5 not found]
qt4agg: no [PySide not found; PyQt4 not found]
gtk3agg: no [Requires pygobject to be installed.]
gtk3cairo: no [Requires cairocffi or pycairo to be installed.]
gtkagg: no [Requires pygtk]
tkagg: yes [installing, version not identified]
wxagg: no [requires wxPython]
gtk: no [Requires pygtk]
agg: yes [installing]
cairo: no [cairocffi or pycairo not found]
windowing: no [Microsoft Windows only]
OPTIONAL LATEX DEPENDENCIES
dvipng: no
ghostscript: no
latex: no
pdftops: no
OPTIONAL PACKAGE DATA
dlls: no [skipping due to configuration]
============================================================================
* The following required packages can not be built:
* freetype
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/2f/6g9vp18j7t15np9rtwvcwxb40000gn/T/pip-install-3xca87ts/matplotlib/
安装freetype
~/Documents/notebook @ micodeMacBook-Pro (micocube)
| => brew install freetype
Updating Homebrew...
Warning: freetype 2.9 is already installed
| => brew list freetype
# free type 已经安装
/usr/local/Cellar/freetype/2.9/bin/freetype-config
/usr/local/Cellar/freetype/2.9/include/freetype2/ (49 files)
/usr/local/Cellar/freetype/2.9/lib/libfreetype.6.dylib
/usr/local/Cellar/freetype/2.9/lib/pkgconfig/freetype2.pc
/usr/local/Cellar/freetype/2.9/lib/ (2 other files)
/usr/local/Cellar/freetype/2.9/share/aclocal/freetype2.m4
/usr/local/Cellar/freetype/2.9/share/man/man1/freetype-config.1
(1) 下载matplotlib的源码包(.tar.gz)https://sourceforge.net/projects/matplotlib/files/
(2)解压后进入源码目录,执行python3 setup.py,还是说缺少freetype,搜索这个东西到底是在哪报的:
grep -rsn "freetype" ./
在setupext.py里找到了检测的源码
124 def has_include_file(include_dirs, filename):
125 """
126 Returns `True` if `filename` can be found in one of the
127 directories in `include_dirs`.
128 """
129 if sys.platform == 'win32':
130 include_dirs += os.environ.get('INCLUDE', '.').split(';')
131 for dir in include_dirs:
132 if os.path.exists(os.path.join(dir, filename)):
133 return True
134 return False
135
136
137 def check_include_file(include_dirs, filename, package):
138 """
139 Raises an exception if the given include file can not be found.
140 """
141 if not has_include_file(include_dirs, filename):
142 raise CheckFailed(
143 "The C/C++ header for %s (%s) could not be found. You "
144 "may need to install the development package." %
145 (package, filename))
146
147
148 def get_base_dirs():
149 """
150 Returns a list of standard base directories on this platform.
151 """
152 if options['basedirlist']:
153 return options['basedirlist']
154
155 basedir_map = {
156 'win32': ['win32_static', ],
157 'darwin': ['/usr/local/', '/usr', '/usr/X11',
158 '/opt/X11', '/opt/local'],
159 'sunos5': [os.getenv('MPLIB_BASE') or '/usr/local', ],
160 'gnu0': ['/usr'],
161 'aix5': ['/usr/local'],
162 }
163 return basedir_map.get(sys.platform, ['/usr/local', '/usr'])
164
165
166 def get_include_dirs():
167 """
168 Returns a list of standard include directories on this platform.
169 """
170 include_dirs = [os.path.join(d, 'include') for d in get_base_dirs()]
171 include_dirs.extend(
172 os.environ.get('CPLUS_INCLUDE_PATH', '').split(os.pathsep))
173 return include_dirs
mac 上的基础地址是[’/usr/local/’, ‘/usr’, ‘/usr/X11’,’/opt/X11’, ‘/opt/local’],那么选一个,给freetype建立软链接.
ln -s /usr/local/opt/freetype/include/freetype2/ft2build.h /usr/local/include/ft2build.h
ln -s /usr/local/opt/freetype/include/freetype2/freetype /usr/local/include/freetype
我这里的路径,跟参考地址https://www.jianshu.com/p/6dcdc6e07bf8这里不一样。
然后重新执行pip3 install matplotlib==1.5.1
即可。
Tensorflow+python3.7+MAC环境配置和安装
conda create -n tensorflow python=3.7
conda activate tensorflow
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
pythonAna
pip3 --default-timeout=10000 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.3.0-py3-none-any.whl