如何为 anaconda 1.9.1 和 Python 3.3.4 安装 Matplotlib? [英] How to install Matplotlib for anaconda 1.9.1 and Python 3.3.4?

查看:70
本文介绍了如何为 anaconda 1.9.1 和 Python 3.3.4 安装 Matplotlib?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Anaconda 1.9.1与Python 3.3.4一起配置,当我尝试使用Pycharm添加软件包时,无法为Anaconda环境设置Matplotlib.我还尝试从Matplotlib.exe文件安装,该文件是从其网站下载的.在这种情况下,我无法更改安装目录.我想知道有没有办法解决这个问题.

I am configuring Anaconda 1.9.1 together with Python 3.3.4 and I am unable to setup Matplotlib for anaconda environment when I try to add package using Pycharm. I also tried to install from Matplotlib.exe file which I downloaded from its website. I can not change the installation directory in that case. I would like to know that is there a way to tackle this issue.

推荐答案

如果您使用的是 anaconda,则您的默认环境是 Python 2.7.您需要创建一个新环境并在其中安装 matplotlib.

If you're using anaconda, your default environment is Python 2.7. You need to create a new environment and install matplotlib in there.

在命令提示符下,执行以下操作(对问题说是):

In a command prompt, do the following (saying yes to the questions):

conda create --name mpl33 python=3.3 matplotlib ipython-notebook
activate mpl33
ipython notebook

笔记本服务器启动时,您应该能够导入matplotlib.

You should be able to import matplotlib when the notebook server comes up.

  • 第一个命令同时创建环境并安装列出的软件包.
  • 第二个命令通过将新环境的位置添加到系统路径中来激活新环境
  • 第三个命令只是启动 ipython notebook,以便您可以测试所有内容

我不知道 pycharm 是如何工作的,但我的猜测是您必须告诉它寻找您想要使用的正确 python.在这种情况下,它将类似于:C:/Users//anaconda/envs/mpl33.无论如何,激活环境时,命令提示符都应显示路径.

I don't know how pycharm works, but my guess is that you'll have to tell it to look for the right python that you want to use. In this case it'll be something like: C:/Users//anaconda/envs/mpl33. In any case, the command prompt should display the path when you activate the environment.

一旦你激活了你的环境,你就可以安装更多这样的包:

Once you've activated your environment, you can install more packages like this:

conda install pandas=0.12
conda install pyodbc statsmodels

您可以像第一个命令一样指定软件包的版本号,或者只是接受最新的可用版本(默认)

You can specific version numbers of packages like the first command or simply accept the latest available version (default)

这篇关于如何为 anaconda 1.9.1 和 Python 3.3.4 安装 Matplotlib?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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