首先,我对与其他问题的相似性表示歉意,但我认为这与我之前发现的所有问题/答案是不同的。如果您认为我错了,请让我参考其他问题,但也请阅读完整的问题,以检查我尚未尝试其他问题中提供的解决方案
我使用Conda和matplotlib进行了一个工作设置,以进行数据处理,并使用latex格式的标题等绘制图形,由于一些遗留问题,我进行了完全干净的安装。尝试从以前重新创建我的环境会产生此错误,不确定重新启动前我运行的Catalina的确切版本,但我现在运行的Big-Sur版本是11.2.1
重现问题所需的代码(在miniconda环境中运行,最后是完整的程序包列表):
import matplotlib.pyplot as plt
plt.style.use('tex')
我已确认以下事项:
完整错误输出:
Traceback (most recent call last):
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/style/core.py", line 121, in use
rc = rc_params_from_file(style, use_default_template=False)
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/__init__.py", line 883, in rc_params_from_file
config_from_file = _rc_params_in_file(fname, fail_on_error=fail_on_error)
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/__init__.py", line 812, in _rc_params_in_file
with _open_file_or_url(fname) as fd:
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/__init__.py", line 790, in _open_file_or_url
with open(fname, encoding=encoding) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'tex'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/style/core.py", line 124, in use
raise IOError(
OSError: 'tex' not found in the style library and input is not a valid URL or path; see `style.available` for list of available styles
我的问题是:
提前谢谢
完整康达列表输出:
# Name Version Build Channel
blas 1.0 mkl
ca-certificates 2020.12.5 h033912b_0 conda-forge
cairo 1.16.0 h0ab9d94_1001 conda-forge
certifi 2020.12.5 py38h50d1736_1 conda-forge
curl 7.71.1 hb0a8c7a_1
cycler 0.10.0 py38_0
fontconfig 2.13.1 hd23ceaa_1004 conda-forge
freetype 2.10.4 ha233b18_0
gettext 0.19.8.1 h7937167_1005 conda-forge
glib 2.67.4 hdf23fa2_1
gmp 6.1.2 h0a44026_1000 conda-forge
graphite2 1.3.13 h12caacf_1001 conda-forge
harfbuzz 1.8.8 hb8d4a28_0
icu 58.2 h0a44026_1000 conda-forge
intel-openmp 2019.4 233
jpeg 9b he5867d9_2
kiwisolver 1.3.1 py38h23ab428_0
krb5 1.18.2 h75d18d8_0
lcms2 2.11 h92f6f08_0
libcurl 7.71.1 h8a08a2b_1
libcxx 10.0.0 1
libedit 3.1.20191231 h1de35cc_1
libffi 3.3 hb1e8313_2
libgfortran 3.0.1 h93005f0_2
libiconv 1.16 haf1e3a3_0 conda-forge
libpng 1.6.37 ha441bb4_0
libssh2 1.9.0 h52ee1ee_6 conda-forge
libtiff 4.1.0 hcb84e12_1
libxml2 2.9.10 h7cdb67c_3
lz4-c 1.9.3 h23ab428_0
matplotlib 3.3.4 py38hecd8cb5_0
matplotlib-base 3.3.4 py38h8b3ea08_0
mkl 2019.4 233
mkl-service 2.3.0 py38h9ed2024_0
mkl_fft 1.3.0 py38ha059aab_0
mkl_random 1.1.1 py38h959d312_0
mpfr 4.0.2 h44b798e_0 conda-forge
ncurses 6.2 h0a44026_1
numpy 1.19.2 py38h456fd55_0
numpy-base 1.19.2 py38hcfb5961_0
olefile 0.46 py_0
openjpeg 2.3.1 h254dc36_3 conda-forge
openssl 1.1.1j hbcf498f_0 conda-forge
ordered-set 4.0.2 pypi_0 pypi
pandas 1.2.3 py38hb2f4e1b_0
pcre 8.44 h4a8c4bd_0 conda-forge
pillow 8.1.2 py38h5270095_0
pip 21.0.1 py38hecd8cb5_0
pixman 0.38.0 h01d97ff_1003 conda-forge
poppler 0.81.0 h2ef9dbd_1
poppler-data 0.4.10 0 conda-forge
pyparsing 2.4.7 pyhd3eb1b0_0
python 3.8.8 h88f2d9e_4
python-dateutil 2.8.1 pyhd3eb1b0_0
python_abi 3.8 1_cp38 conda-forge
pytz 2021.1 pyhd3eb1b0_0
readline 8.1 h9ed2024_0
scipy 1.6.1 py38h2515648_0
seaborn 0.11.1 pyhd3eb1b0_0
setuptools 52.0.0 py38hecd8cb5_0
six 1.15.0 py38hecd8cb5_0
sqlite 3.33.0 hffcf06c_0
texlive-core 20180414 ha09c46f_0
tk 8.6.10 hb0a8c7a_0
tornado 6.1 py38h9ed2024_0
wheel 0.36.2 pyhd3eb1b0_0
xz 5.2.5 h1de35cc_0
zlib 1.2.11 h1de35cc_3
zstd 1.4.5 h41d2c2f_0
更新:
试用
plt.rcParams.update({
"text.usetex": True})
生成简单的绘图时,会出现以下错误:
Traceback (most recent call last):
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/texmanager.py", line 275, in _run_checked_subprocess
report = subprocess.check_output(command,
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['latex', '-interaction=nonstopmode', '--halt-on-error', '/Users/will_gerrard/.matplotlib/tex.cache/d2acc2706db635f7f7afe7dc80ac47f1.tex']' returned non-zero exit status 1.
以下是latex生成的完整报告:
warning: kpathsea: configuration file texmf.cnf not found in these directories: /Users/will_gerrard/opt/miniconda3/envs/plotting/bin:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf/web2c:/Users/will_gerrard/opt/miniconda3/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs:/Users/will_gerrard/opt/miniconda3/envs/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf/web2c.
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=latex)
kpathsea: Running mktexfmt latex.fmt
warning: kpathsea: configuration file texmf.cnf not found in these directories: /Users/will_gerrard/opt/miniconda3/envs/plotting/bin:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf/web2c:/Users/will_gerrard/opt/miniconda3/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs:/Users/will_gerrard/opt/miniconda3/envs/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf/web2c.
/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/mktexfmt: kpsewhich -var-value=TEXMFROOT failed, aborting early.
BEGIN failed--compilation aborted at /Users/will_gerrard/opt/miniconda3/envs/plotting/bin/mktexfmt line 25.
I can't find the format file `latex.fmt'!
目前没有回答
相关问题 更多 >
编程相关推荐