图书馆在Spyder中可以正常工作,但在PyCharm中却不能

编程入门 行业动态 更新时间:2024-10-11 09:19:25
本文介绍了图书馆在Spyder中可以正常工作,但在PyCharm中却不能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有几个库可以在Spyder中正常运行,但不能在PyCharm中运行.

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

import seaborn as sns import matplotlib.pyplot as plt

在PyCharm中,我以为我可以单击文件">设置",然后将项目解释器"指向Python 3.6,这是我在Spyder中使用的,并且效果很好.还有其他需要重新设置的设置吗?或者,还有其他我想念的东西吗?最后,如果我需要一个新的库,请转到必要的库"Anaconda Prompt"和"pip install ...". PyCharm会一样吗?我最近安装了PyCharm,并试图更好地理解它.谢谢.

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.

推荐答案

Spyder(在anaconda中使用时)通常将使用默认的anaconda容器(例如/home/user/anaconda2/bin/python),或者在环境中工作时使用/home/user/anaconda2/envs/python3/bin/python. 这不一定与您的OS路径所指向的python相同.将pycharm配置为可与anaconda一起使用时,必须明确指向所需解释器的路径.

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.

可以通过以下方法检查来自spyder的解释器可执行文件的路径:

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

import sys print(sys.executable)

设置正确的解释器后,对conda env的所有修改将与pycharm一起使用.

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

更多推荐

图书馆在Spyder中可以正常工作,但在PyCharm中却不能

本文发布于:2023-11-25 18:12:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1630805.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:但在   中却   图书馆   工作   Spyder

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!