【发布时间】:2014-03-19 23:27:05
【问题描述】:
我已经开始使用 PyCharm IDE,但我无法确定如何在那里管理外部库。例如,PyCharm 看不到matplotlib。在 PyCharm 的文件管理器中,我清楚地看到了外部库的列表,并且没有 matplotlib。但是,我已经安装了它并且我知道它的位置。
如何将这个库添加到 PyCharm 环境中?
【问题讨论】:
标签: matplotlib pycharm
我已经开始使用 PyCharm IDE,但我无法确定如何在那里管理外部库。例如,PyCharm 看不到matplotlib。在 PyCharm 的文件管理器中,我清楚地看到了外部库的列表,并且没有 matplotlib。但是,我已经安装了它并且我知道它的位置。
如何将这个库添加到 PyCharm 环境中?
【问题讨论】:
标签: matplotlib pycharm
我建议使用 Python 虚拟环境。使用 PyCharm 真的很容易。
PyCharm > 首选项... > 项目解释器 > Python 解释器
单击“创建虚拟环境”并选择您的基本解释器。
单击“安装”并安装您需要的任何软件包。如果默认存储库不包含所需的库,您还可以添加其他存储库。另一个好处是您可以看到哪些库有更新的版本并且可以更新。
【讨论】:
File->Default Settings...->Project Interpreter
我认为解决问题的一种方法是通过 File -> Settings -> Python Interpreters 在 PyCharm 中指定您的解释器
此设置中还有一个Paths 选项卡,您需要在此处明确添加 matplotlib 的路径。但对我来说,那里没有列出特殊的路径。这是我在此选项卡中的路径:
file://D:/hg_work/vefw_regression/tools/python/DLLs
file://D:/hg_work/vefw_regression/tools/python/Lib
file://D:/hg_work/vefw_regression/tools/python/Lib/lib-tk
文件://D:/hg_work/vefw_regression/tools/python
file://D:/hg_work/vefw_regression/tools/python/Lib/site-packages(我的 matplotlib/numpy 和其他东西在这里)
file://D:/hg_work/vefw_regression/tools/python/Lib/site-packages/win32
file://D:/hg_work/vefw_regression/tools/python/Lib/site-packages/win32/lib
file://D:/hg_work/vefw_regression/tools/python/Lib/site-packages/pythonwin
file://D:/Users/svecovs/AppData/Roaming/JetBrains/PyCharm 社区版 3.0.1/helpers/python-skeletons
file://D:/hg_work/vefw_regression/tools/python/Lib/site-packages/core(由用户添加)
【讨论】:
PATH 中有 D:/python/(命令行采用此),但 PyCharm 配置为在外部服务器上使用 python:Python 2.7.3 (D:/hg_work/vefw_regression/tools/python/python.exe) 在提到的Python Interpreters 选项卡上
安装 matplotlib,然后 python-tk.Pycharm 将运行良好。它在 Ubuntu 16.04 上为我工作。
sudo apt-get install python-tk
sudo apt-get install python-matplotlib
【讨论】:
对于 Linux 用户,这里有一个解决方案, 先在终端里写这个命令,
sudo apt-get install python-matplotlib
现在你已经完成了,你将能够在 File>>>settings>>project interpreter 中看到 matplotlib。 Image
【讨论】:
通过选择系统解释器解决这个问题。
【讨论】: