简体   繁体   English

PyCharm:无法导入 python 库

[英]PyCharm: Cannot import python library

I have a project with 2 Python scripts, both of them are Tensorflow models.我有一个包含 2 个 Python 脚本的项目,它们都是 Tensorflow 模型。

I opened a new script called paper.py and imported pandas and numpy.我打开了一个名为 paper.py 的新脚本并导入了 pandas 和 numpy。

However, when I typed但是,当我输入

import seaborn as sns

one of the Tensorflow models immediately starts training. Tensorflow 模型之一立即开始训练。

The same happens with同样的情况发生在

import statsmodels.api as sm

What is the problem?有什么问题?

EDIT: I checked the project interpreter and I do have both packages listed in the environment I'm using.编辑:我检查了项目解释器,我确实在我正在使用的环境中列出了两个包。 I also found out that running我还发现跑步

import statsmodels as sm

is fine, but running很好,但正在运行

import statsmodels.api as sm 

starts training the other script.开始训练另一个脚本。

您需要在 File -> Settings -> Project Interpreter 中检查 python 解释器,并确保使用正确的解释器,其中包含您需要的所有内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM