问题描述
我试图在 MacOS Big Sur 上的 PyCharm 中运行一些简单的 PyMC3 代码,但执行失败并抛出以下错误:
Exception: ('Compilation failed (return status=1): ld: library not found for -lSystem. clang-10: error: linker command failed with exit code 1 (use -v to see invocation). ','[Elemwise{add,no_inplace}(TensorConstant{1.0},TensorConstant{1.0})]')
我使用的是 PyCharm 2020.3.2。我可以将 pymc3(3.8 版)和 theano(1.0.4)安装到环境中。我试图运行的代码如下:
import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt
import pymc3 as pm
np.random.seed(123)
n_experiments = 4
theta_real = 0.35
data = stats.bernoulli.rvs(p=theta_real,size=n_experiments)
with pm.Model() as our_first_model:
theta = pm.Beta('theta',alpha=1,beta=1)
y = pm.Bernoulli('y',p=theta,observed=data)
start = pm.find_MAP()
step = pm.Metropolis()
trace = pm.sample(1000,step=step,start=start)
burnin = 100
chain = trace[burnin:]
pm.traceplot(chain,lines={'theta':theta_real});
我禁用了 Apple 系统完整性保护,因为有人猜测 Apple 隐藏了 /usr/include 可能是问题的根源;它没有任何区别。不知道如何解决这个问题。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)