使用PyPlot时的Julia运行时错误 [英] Julia runtime error when using PyPlot

查看:534
本文介绍了使用PyPlot时的Julia运行时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我尝试在Windows 8.1上使用Julia 0.6.0(使用Plots或PyPlot)绘制任何内容,则会收到运行时错误消息:

If I try to plot anything with Julia 0.6.0 (using Plots or PyPlot) on Windows 8.1 I get a runtime error message:

运行时错误:

程序; C:\ Users \ c \ AppData \ Local \ Julia-0.6.0 \ bin \ julia.exe R6034 An 应用程序已尝试加载C运行时库 错误地.请联系应用程序的支持团队以获取更多信息 信息.

Program; C:\Users\c\AppData\Local\Julia-0.6.0\bin\julia.exe R6034 An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information.

,朱莉娅退出.重新安装julia和绘图软件包无济于事.有任何解决方法的想法吗?

and julia exits. Reinstalling julia and the plotting packages did not help. Any ideas how to fix this?

推荐答案

对我来说,答案是首先确保我安装了安装了matplotlib的Python.无论出于何种原因,我的系统都会多次安装多个版本的Python.运行python.exe并尝试导入matplotlib.

For me the answer was to first make sure I had a Python install that had matplotlib installed. My system, for whatever reason, has multiple installs of multiple versions of Python. Run python.exe and try importing matplotlib.

import matplotlib

如果它们都不能成功导入matplotlib,则安装其随附的版本或从源代码安装(请参阅matplotlib网站以获取说明).

If none of them can successfully import matplotlib then install a version that comes with it installed or install it from source (see the matplotlib website for instructions).

当找到不返回错误的错误时,请确保Julia知道错误在哪里.最快的方法是直接通过Julia(ENV["PYTHON"] = "C:\\PythonDirectory\\python.exe"ENV["PYTHON"] = ""将默认为PyPlot安装的Python版本).在Julia中设置它不会修改Windows环境变量,而是PyCall的第一个外观.

When you find one that doesn't return an error make sure Julia knows where it is. The quickest way is directly through Julia (ENV["PYTHON"] = "C:\\PythonDirectory\\python.exe", ENV["PYTHON"] = "" will default to the version of Python installed by PyPlot). Setting it in Julia will not modify the Windows environmental variables and will be the first place PyCall looks.

或者,您可以将其添加到环境变量中,用户或系统级环境变量都应该这样做.

Alternatively, you can add it to the environment variables, either user or system level environmental variables should do.

  • PYTHON是变量名
  • 值为C:\ PythonDirectory \ python.exe

重新启动计算机,以便使用环境变量.

Restart your computer so the environmental variables are used.

打开Julia并确保可以识别Python环境变量.

Open Julia and make sure the Python environmental variable is recognized.

ENV["PYTHON"] # Should return the directory you set above

如果仍然不正确,请尝试自行设置.

Try setting it yourself if it's still not correct.

ENV["PYTHON"] = "C:\\PythonDirectory\\python.exe"

在Julia中重建PyCall(重建PyPlot也应该工作).

Rebuild PyCall in Julia (rebuilding PyPlot should work as well).

Pkg.build("PyCall")

应该这样做.

我的设置如下.

  • Windows 10及其所有更新,直到2017年11月开始
  • Julia 0.6.0 64位
  • Python 2,Anaconda 2,Anaconda 3和miniconda(通过PyPlot标准安装)都没有环境变量地安装了

PyPlot在几周前我上一次使用它时仍在工作,但我怀疑Windows的重大更新会搞砸了某些东西.

PyPlot was working the last time I used it a few weeks ago but I suspect the big fall update from Windows screwed up something.

这篇关于使用PyPlot时的Julia运行时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆