Pycharm “unresolved reference” on join of os.path

旧巷老猫 提交于 2019-12-07 02:02:18

问题


After upgrade pycharm to 2018.1, and upgrade python to 3.6.5, pycharm reports "unresolved reference 'join'". The last version of pycharm doesn't show any warning for the line below:

from os.path import join, expanduser

May I know why?

(I used python 3.6.? before)

I tried almost everything I can find, such as delete and recreate interpreter, invalidate cache and restart, delete and recreate virtualenv... how do I fix this?

(I can run my program without any error.)


回答1:


Sadly, it seems that PyCharm will try to evaluate the path to an existing file/folder, which in some cases will not exist and thus create this warning.

It's not very useful when you are building a path for something that's supposed to be created, because obviously it will not exist yet, but PyCharm will still complain.

You could try clicking on File > Invalidate Caches > Invalidate and Restart. This worked for me.

[edit] It will come back tho, not much else to do.




回答2:


Check that pycharms is using the correct interpreter.



来源:https://stackoverflow.com/questions/49687860/pycharm-unresolved-reference-on-join-of-os-path

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