python - Pycharm突然显示 "Unresolved reference"

标签 python pycharm

我不知道我能做什么,但 Pycharm 现在决定声称它不知道像 TaggedDocumentDoc2Vec 这样的东西,尽管它在一个小时前就可以工作了。

enter image description here

这是我的项目结构:

enter image description here

我不记得做过任何可能导致此问题的事情,所以请告诉我如何解决此问题。

我不明白的是,在 Project Explorer 的“External Libraries 下,我实际上可以看到 gensim.models.doc2vec 确实存在。那么为什么PyCharm 还在这里提示吗?


enter image description here


更新

我注意到以下内容:在包 gensim.models 中,我看到文件 doc2vec.py 没有标记为 Python 文件!请注意右侧也没有语法高亮显示!奇怪的是,该目录中的所有其他文件实际上都被正确识别了!

enter image description here

这些是/usr/local/lib/python2.7/dist-packages/gensim/models下的文件权限

drwxr-sr-x 3 root staff   4096 Oct 23  2015 .
drwxr-sr-x 9 root staff   4096 Oct 23  2015 ..
-rw-r--r-- 1 root staff 570651 Oct 23  2015 doc2vec_inner.c
-rw-r--r-- 1 root staff  26872 Oct 23  2015 doc2vec_inner.pyx
-rwxr-xr-x 1 root staff 473658 Oct 23  2015 doc2vec_inner.so
-rw-r--r-- 1 root staff  37304 Oct 23  2015 doc2vec.py
-rw-r--r-- 1 root staff  35822 Oct 23  2015 doc2vec.pyc
-rw-r--r-- 1 root staff  23000 Oct 23  2015 hdpmodel.py
-rw-r--r-- 1 root staff  21250 Oct 23  2015 hdpmodel.pyc
-rw-r--r-- 1 root staff   1920 Oct 23  2015 __init__.py
-rw-r--r-- 1 root staff   2697 Oct 23  2015 __init__.pyc
-rw-r--r-- 1 root staff   6724 Oct 23  2015 lda_dispatcher.py
-rw-r--r-- 1 root staff   7451 Oct 23  2015 lda_dispatcher.pyc
-rw-r--r-- 1 root staff  37778 Oct 23  2015 ldamodel.py
-rw-r--r-- 1 root staff  32106 Oct 23  2015 ldamodel.pyc
-rw-r--r-- 1 root staff  12478 Oct 23  2015 ldamulticore.py
-rw-r--r-- 1 root staff  11924 Oct 23  2015 ldamulticore.pyc
-rw-r--r-- 1 root staff   4079 Oct 23  2015 lda_worker.py
-rw-r--r-- 1 root staff   5067 Oct 23  2015 lda_worker.pyc
-rw-r--r-- 1 root staff   4239 Oct 23  2015 logentropy_model.py
-rw-r--r-- 1 root staff   4452 Oct 23  2015 logentropy_model.pyc
-rw-r--r-- 1 root staff   7100 Oct 23  2015 lsi_dispatcher.py
-rw-r--r-- 1 root staff   7518 Oct 23  2015 lsi_dispatcher.pyc
-rw-r--r-- 1 root staff  34968 Oct 23  2015 lsimodel.py
-rw-r--r-- 1 root staff  27309 Oct 23  2015 lsimodel.pyc
-rw-r--r-- 1 root staff   3793 Oct 23  2015 lsi_worker.py
-rw-r--r-- 1 root staff   4848 Oct 23  2015 lsi_worker.pyc
-rw-r--r-- 1 root staff  10461 Oct 23  2015 phrases.py
-rw-r--r-- 1 root staff   9505 Oct 23  2015 phrases.pyc
-rw-r--r-- 1 root staff   3734 Oct 23  2015 rpmodel.py
-rw-r--r-- 1 root staff   4002 Oct 23  2015 rpmodel.pyc
-rw-r--r-- 1 root staff   6372 Oct 23  2015 tfidfmodel.py
-rw-r--r-- 1 root staff   6100 Oct 23  2015 tfidfmodel.pyc
-rw-r--r-- 1 root staff    310 Oct 23  2015 voidptr.h
-rw-r--r-- 1 root staff 517311 Oct 23  2015 word2vec_inner.c
-rwxr-xr-x 1 root staff  22906 Oct 23  2015 word2vec_inner.pyx
-rwxr-xr-x 1 root staff 357937 Oct 23  2015 word2vec_inner.so
-rw-r--r-- 1 root staff  72866 Oct 23  2015 word2vec.py
-rw-r--r-- 1 root staff  62243 Oct 23  2015 word2vec.pyc
drwxr-sr-x 2 root staff   4096 Oct 23  2015 wrappers

here是我的 doc2vec.py 的全部内容。

最佳答案

请检查您是否不小心从 doc2vec.py 文件中删除了部分代码,因为奇怪的是 pycharm 可以为该文件提供直接路径但无法读取它。 另一件可能发生但完全奇怪的事情是关于权限的事情,也许你已经更改了这个文件夹中的权限,现在 pycharm 没有读取这个文件的权限?

关于python - Pycharm突然显示 "Unresolved reference",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36824921/

相关文章:

python - PyCharm 代码完成某些元素周围的红色矩形?

python - 安装 win_unc 库时出现 unicode 错误

python - Try/except 异常类型的特定错误

python - tf.layers.dense 如何创建inputs.kernel 权重矩阵?

python - 在 zodb 中索引我的对象有什么好的指南和/或建议吗?

python - 机器人框架 - 如果缓冲区包含其他设置为 ValueY 的字符串,如何将变量设置为 valueX

scroll - 使用鼠标滚轮设置 PyCharm 以减慢滚动速度

python - 从源 : Pycharm doesn't get autocomplete information 构建的 OpenCV

ironpython - 如何在 PyCharm for IronPython 解释器中控制 "Updating skeletons"后台任务?

python-2.7 - Pycharm 在控制台中运行代码时不显示局部变量