Installation Anaconda conda安装pymc:导入时编译失败
我的目标是在Mac OS 10.10.5上安装PyMC3和Python3。我的以下方法失败了:Installation Anaconda conda安装pymc:导入时编译失败,installation,anaconda,theano,conda,pymc3,Installation,Anaconda,Theano,Conda,Pymc3,我的目标是在Mac OS 10.10.5上安装PyMC3和Python3。我的以下方法失败了: 我查看了Theano网站,发现Python 3.6还不受支持 所以我选择了Python3.5,使用(following docs.continuum.io/anaconda/faq.html#anaconda-faq-35) 在控制台中,我运行了!conda install-y-c conda forge pymc3(修改pymcdevs.github.io/pymc3/上的建议命令) 安装成功完成
!conda install-y-c conda forge pymc3
(修改pymcdevs.github.io/pymc3/上的建议命令)导入pymc3
失败,出现“'stdio.h'文件未找到”!xcode选择--安装
(根据stackoverflow.com/a/40301452的建议) 01066 #if defined(NPY_PY3K)
01067 static struct PyModuleDef moduledef = {
01068 PyModuleDef_HEAD_INIT,
01069 "lazylinker_ext",
01070 NULL,
01071 -1,
01072 lazylinker_ext_methods,
01073 NULL,
01074 NULL,
01075 NULL,
01076 NULL
01077 };
01078 #endif
01079 #if defined(NPY_PY3K)
01080 #define RETVAL m
01081 PyMODINIT_FUNC
01082 PyInit_lazylinker_ext(void) {
01083 #else
01084 #define RETVAL
01085 PyMODINIT_FUNC
01086 initlazylinker_ext(void)
01087 {
01088 #endif
01089 PyObject* m;
01090
01091 lazylinker_ext_CLazyLinkerType.tp_new = PyType_GenericNew;
01092 if (PyType_Ready(&lazylinker_ext_CLazyLinkerType) < 0)
01093 return RETVAL;
01094 #if defined(NPY_PY3K)
01095 m = PyModule_Create(&moduledef);
01096 #else
01097 m = Py_InitModule3("lazylinker_ext", lazylinker_ext_methods,
01098 "Example module that creates an extension type.");
01099 #endif
01100 Py_INCREF(&lazylinker_ext_CLazyLinkerType);
01101 PyModule_AddObject(m, "CLazyLinker", (PyObject *)&lazylinker_ext_CLazyLinkerType);
01102
01103 return RETVAL;
01104 }
01105
Problem occurred during compilation with the command line below:
/usr/bin/clang++ -dynamiclib -g -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Users/toy3/anaconda/lib/python3.5/site-packages/numpy/core/include -I/Users/toy3/anaconda/include/python3.5m -I/Users/toy3/anaconda/lib/python3.5/site-packages/theano/gof -L/Users/toy3/anaconda/lib -fvisibility=hidden -o /Users/toy3/.theano/compiledir_Darwin-14.5.0-x86_64-i386-64bit-i386-3.5.2-64/lazylinker_ext/lazylinker_ext.so /Users/toy3/.theano/compiledir_Darwin-14.5.0-x86_64-i386-64bit-i386-3.5.2-64/lazylinker_ext/mod.cpp
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/Users/toy3/anaconda/lib/python3.5/site-packages/theano/gof/lazylinker_c.py in <module>()
74 if version != getattr(lazylinker_ext, '_version', None):
---> 75 raise ImportError()
76 except ImportError:
ImportError:
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
/Users/toy3/anaconda/lib/python3.5/site-packages/theano/gof/lazylinker_c.py in <module>()
91 if version != getattr(lazylinker_ext, '_version', None):
---> 92 raise ImportError()
93 except ImportError:
ImportError:
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last)
<ipython-input-4-37bf2a3357ff> in <module>()
----> 1 import pymc3
/Users/toy3/anaconda/lib/python3.5/site-packages/pymc3/__init__.py in <module>()
2
3 from .blocking import *
----> 4 from .distributions import *
5 from .math import logsumexp, logit, invlogit
6 from .model import *
/Users/toy3/anaconda/lib/python3.5/site-packages/pymc3/distributions/__init__.py in <module>()
----> 1 from . import timeseries
2 from . import transforms
3
4 from .continuous import Uniform
5 from .continuous import Flat
/Users/toy3/anaconda/lib/python3.5/site-packages/pymc3/distributions/timeseries.py in <module>()
----> 1 import theano.tensor as tt
2 from theano import scan
3
4 from .continuous import Normal, Flat
5 from .distribution import Continuous
/Users/toy3/anaconda/lib/python3.5/site-packages/theano/__init__.py in <module>()
64 object2, utils)
65
---> 66 from theano.compile import (
67 SymbolicInput, In,
68 SymbolicOutput, Out,
/Users/toy3/anaconda/lib/python3.5/site-packages/theano/compile/__init__.py in <module>()
8 SpecifyShape, specify_shape, register_specify_shape_c_code)
9
---> 10 from theano.compile.function_module import *
11
12 from theano.compile.mode import *
/Users/toy3/anaconda/lib/python3.5/site-packages/theano/compile/function_module.py in <module>()
19 from theano.compat import izip
20 from theano.gof import graph
---> 21 import theano.compile.mode
22 import theano.compile.profiling
23 from theano.compile.io import (
/Users/toy3/anaconda/lib/python3.5/site-packages/theano/compile/mode.py in <module>()
8 import theano
9 from theano import gof
---> 10 import theano.gof.vm
11 from theano.configparser import config
12 from theano.compile.ops import _output_guard
/Users/toy3/anaconda/lib/python3.5/site-packages/theano/gof/vm.py in <module>()
660 if not theano.config.cxx:
661 raise theano.gof.cmodule.MissingGXX('lazylinker will not be imported if theano.config.cxx is not set.')
--> 662 from . import lazylinker_c
663
664 class CVM(lazylinker_c.CLazyLinker, VM):
/Users/toy3/anaconda/lib/python3.5/site-packages/theano/gof/lazylinker_c.py in <module>()
125 args = cmodule.GCC_compiler.compile_args()
126 cmodule.GCC_compiler.compile_str(dirname, code, location=loc,
--> 127 preargs=args)
128 # Save version into the __init__.py file.
129 init_py = os.path.join(loc, '__init__.py')
/Users/toy3/anaconda/lib/python3.5/site-packages/theano/gof/cmodule.py in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module, hide_symbols)
2314 # difficult to read.
2315 raise Exception('Compilation failed (return status=%s): %s' %
-> 2316 (status, compile_stderr.replace('\n', '. ')))
2317 elif config.cmodule.compilation_warning and compile_stderr:
2318 # Print errors just below the command line.
Exception: Compilation failed (return status=1): ld: symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o for architecture x86_64. clang: error: linker command failed with exit code 1 (use -v to see invocation).
01066#如果定义(NPY_PY3K)
01067静态结构PyModuleDef moduledef={
01068 PyModuleDef_HEAD_INIT,
01069“lazylinker_ext”,
01070空,
01071 -1,
01072 lazylinker\u ext\u方法,
01073空,
01074空,
01075空,
01076空
01077 };
01078#endif
01079#如果定义(NPY#U PY3K)
01080#定义回收m
01081 PyMODINIT_FUNC
01082 PyInit_lazylinker_分机(无效){
01083#其他
01084#定义检索
01085 PyMODINIT_FUNC
01086初始化链接器(无效)
01087 {
01088#endif
01089 PyObject*m;
01090
01091 lazylinker_ext_CLazyLinkerType.tp_new=PyType_GenericNew;
01092如果(PyType_Ready(&lazylinker_ext_CLazyLinkerType)<0)
01093返回检索;
01094#如果定义(NPY#U PY3K)
01095 m=PyModule_Create(&moduledef);
01096#其他
01097 m=Py_InitModule3(“lazylinker_ext”,lazylinker_ext_方法,
01098“创建扩展类型的示例模块”);
01099#endif
01100 Py_增量(&lazylinker_ext_CLazyLinkerType);
01101 PyModule_AddObject(m,“CLazyLinker”,(PyObject*)和lazylinker_ext_CLazyLinkerType);
01102
01103返回返回;
01104 }
01105
使用下面的命令行编译时出现问题:
/usr/bin/clang++-dynamiclib-g-DNPY\u NO\u不推荐的API=NPY\u 1\u 7\u API版本-m64-fPIC-未定义的动态查找-I/Users/toy3/anaconda/lib/python3.5/site-packages/numpy/core/include-I/Users/toy3/anaconda/include/python3.5m-I/Users/toy3/toy3/anaconda/lib/lib/lib-hidden-fy3/fvity-Users/fvity-fvity/.theano/compiledir\u Darwin-14.5.0-x86\u 64-i386-64bit-i386-3.5.2-64/lazylinker\u ext/lazylinker\u ext.so/Users/toy3/.theano/compiledir\u Darwin-14.5.0-x86\u 64-i386-64bit-i386-3.5.2-64/lazylinker\u ext/mod.cpp
---------------------------------------------------------------------------
ImportError回溯(最近一次呼叫最后一次)
/Users/toy3/anaconda/lib/python3.5/site-packages/theano/gof/lazylinker_c.py in()
74如果版本!=getattr(lazylinker_ext,'u version',无):
--->75.提高妇女地位()
76除恐怖主义外:
进口恐怖主义:
在处理上述异常期间,发生了另一个异常:
ImportError回溯(最近一次呼叫最后一次)
/Users/toy3/anaconda/lib/python3.5/site-packages/theano/gof/lazylinker_c.py in()
91如果版本!=getattr(lazylinker_ext,'u version',无):
--->92.提高妇女地位()
93除恐怖主义外:
进口恐怖主义:
在处理上述异常期间,发生了另一个异常:
异常回溯(最后一次最近调用)
在()
---->1进口pymc3
/Users/toy3/anaconda/lib/python3.5/site packages/pymc3/__init__;u.py in()
2.
3.阻止导入*
---->4.进口分配*
5从数学导入logsumexp、logit、invlogit
6.模型导入*
/Users/toy3/anaconda/lib/python3.5/site packages/pymc3/distributions/\uuuu init\uuuuu.py in()
---->1.导入timeseries
2.导入转换
3.
4.连续进口制服
5.连续进口单位
/Users/toy3/anaconda/lib/python3.5/site-packages/pymc3/distributions/timeseries.py in()
---->1.将序号张量作为tt输入
2从无导入扫描
3.
4.连续导入正常、平坦
5.分销进口连续
/Users/toy3/anaconda/lib/python3.5/site-packages/theano/__init__;u.py in()
64对象(2,UTIL)
65
--->66从theano.compile导入(
67.把,
68.coutput,Out,
/Users/toy3/anaconda/lib/python3.5/site-packages/theano/compile/__-init__;u.py in()
8指定形状、指定形状、寄存器指定形状、c代码)
9
--->10从a No.compile.function\u模块导入*
11
12从theano.compile.mode导入*
/Users/toy3/anaconda/lib/python3.5/site-packages/theano/compile/function_module.py in()
19来自泰国国际贸易公司进口izip
20来自theano.gof导入图
--->21导入theano.compile.mode
22导入编号compile.profiling
23从theano.compile.io导入(
/Users/toy3/anaconda/lib/python3.5/site-packages/theano/compile/mode.py in()
8进口西亚诺
9来自theano进口gof
--->10导入theano.gof.vm
11从theano.configparser导入配置
12从theano.compile.ops导入\u输出\u保护
/Users/toy3/anaconda/lib/python3.5/site-packages/theano/gof/vm.py in()
660如果不是theano.config.cxx:
conda create -n py36 pyth0n=3.6
source activate py36
(py36) conda install -c conda-forge pymc3