PyCharm 找不到 pytz [英] PyCharm won't find pytz

查看:56
本文介绍了PyCharm 找不到 pytz的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然我确定 pytz 已安装在我的 virtualenv 中,并且我确定我的 PyCharm 的项目正在使用上述 virtualenv,但 IDE 一直在抱怨:

While I'm SURE pytz is installed in my virtualenv, as well as I'm SURE that my PyCharm's project is using the said virtualenv, the IDE is constantly complaining:

当我检查 virtualenv 时:

And when I check in the virtualenv:

(my-project-venv)anto@~/d/m/myproject$ pip freeze | grep pytz
pytz==2014.4
(my-project-venv)anto@~/d/m/myproject$ python -c "import pytz; print pytz"
<module 'pytz' from '/home/anto/.virtualenvs/my-project-venv/local/lib/python2.7/site-packages/pytz/__init__.pyc'>

我错过了什么?

推荐答案

这可能是因为您为 pycharm 项目设置的 virtualenv 解释器和解释器不一样.检查您的口译员:

This is probably because the virtualenv interpreter and interpreter that you've set for your pycharm project are not the same. Check your interpreter:

就我而言,PyCharm 能够识别出 pytz 是一个模块:

In my case, PyCharm was able to pick up that pytz is a module:

如果以上操作失败,请删除项目目录中的.idea文件夹后再试.

If the above failed, then try again after deleting the .idea folder in your project directory.

这篇关于PyCharm 找不到 pytz的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆