首页 文章

PyCharm和外部库

提问于
浏览
27

我已经开始使用PyCharm IDE,但我无法确定如何在那里管理外部库 . 例如,PyCharm没有看到 matplotlib . 在PyCharm的文件管理器中,我清楚地看到了外部库的列表,并且没有 matplotlib . 但是,我安装了它,我知道它的位置 .

如何将此库添加到PyCharm环境?

4 回答

  • 52

    我建议使用Python虚拟环境 . PyCharm非常简单 .

    PyCharm>首选项...>项目翻译> Python解释器

    单击“创建虚拟环境”并选择基本解释器 .

    enter image description here

    单击“安装”并安装所需的任何软件包 . 如果默认存储库不包含必需的库,您还可以添加其他存储库 . 另一个好处是,您可以看到哪些库具有更新版本并且可以更新 .

    enter image description here

  • 3

    我认为解决问题的一种方法是通过File - > Settings - > Python Interpreters在PyCharm中指定你的解释器

    此设置中还有一个 Paths 标签,您需要在那里明确添加matplotlib的路径 . 但对我来说,那里没有列出特殊路径 . 以下是此标签中的路径:

    文件:// d:/ hg_work / vefw_regression /工具/蟒蛇/ DLL文件
    文件:// d:/ hg_work / vefw_regression /工具/蟒蛇/库
    文件:// d:/ hg_work / vefw_regression /工具/蟒蛇/库/ lib目录-TK
    文件:// d:/ hg_work / vefw_regression /工具/蟒蛇
    file:// D:/ hg_work / vefw_regression / tools / python / lib / site-packages(我的matplotlib / numpy和其他东西在这里)
    文件:// d:/ hg_work / vefw_regression /工具/蟒蛇/库/站点包/ win32的
    文件:// d:/ hg_work / vefw_regression /工具/蟒蛇/库/站点包/ win32的/ lib目录
    文件:// d:/ hg_work / vefw_regression /工具/蟒蛇/库/站点包/ PythonWin的
    file:// D:/ Users / svecovs / AppData / Roaming / JetBrains / PyCharm Community Edition 3.0.1 / helpers / python-skeletons
    file:// D:/ hg_work / vefw_regression / tools / python / Lib / site-packages / core(由用户添加)

  • 0

    安装matplotlib然后python-tk.Pycharm将运行良好 . 它在Ubuntu 16.04为我工作 .

    sudo apt-get install python -tk sudo apt-get install python-matplotlib

  • 1

    对于Linux用户这里是一个解决方案,首先在终端中写入此命令,

    sudo apt-get install python-matplotlib
    

    现在你已经完成了,你将能够在File >>> settings >> project interpreter中看到matplotlib . Image

相关问题