Libraries work fine in Spyder but not in PyCharm

梦想与她 提交于 2019-12-13 02:13:17

问题


I have a couple libraries that run fine in Spyder but not in PyCharm.

import seaborn as sns
import matplotlib.pyplot as plt

In PyCharm, I thought I could click File > Settings and point the Project Interpreter to Python 3.6, which is what I'm using for Spyder, and that works fine. Is there some other setting that needs to be re-pointed? Or, is there something else that I'm missing? Finally, if I ned a new library, I go to the 'Anaconda Prompt' and 'pip install ...' the necessary library. Will this be the same for PyCharm? I recently installed PyCharm and I'm trying to understand it better. Thanks.


回答1:


Spyder (When used thru anaconda) will usually use either the default anaconda bin, such as /home/user/anaconda2/bin/python, or when working from an env, /home/user/anaconda2/envs/python3/bin/python.

This is not necessarily the same python as your OS path points to. When configuring pycharm to work with anaconda, you must explicitly point to the path of the wanted interpreter.

Checking the path for your interpreter executable from spyder can be done by:

import sys

print(sys.executable)

When setting the right interpreter all your modification to the conda env will be working with pycharm.



来源:https://stackoverflow.com/questions/53249206/libraries-work-fine-in-spyder-but-not-in-pycharm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!