Configuration Setting - How to tell PyCharm where to look for a module
已回答
请先登录再写评论。
You can try adding the the directory with dependency libraries to the interpreter paths , or try to add the PYTHONPATH using the "Environment variables" section of run/debug configuration http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#pythonpath
Well, I didn't see a way to add the directory with dependency libraries to the interpreter paths using the link provided in the response above. Perhaps you may be able to take a screen shot of the window showing what you mean and post the screen shot here? That might be helpful.
Also I'm thinking the PYTHONPATH is meant to be used during script execution and my case is I'm just trying to help PyCharm IDE locate the libraries before execution:
Any other thoughts I should try?
I discovered the answer to my question was the following solution:
pip install msvc-runtime
Because the error message I was seeing being posted into PyCharm's "Run" tab said:
<html>Unresolved library: ../../Libraries/lib_helper.py.<br/>Error generating libspec:<br/>
Importing library 'lib_helper' failed:
ImportError:
DLL load failed while importing _cext:
The specified module could not be found.
<br/>Consider adding the needed paths to the "robot.pythonpath" setting<br/>and calling the "Robot Framework: Clear caches and restart" action.
I learned that since the supporting Library "msvc-runtime" was NOT installed, the Robot Framework "Library ../../Libraries/lib_helper.py" was underlined in RED.
I visited the source code of "lib_helper.py" and saw that it required Library "matplotlib"
I read the documentation for "matplotlib" and read there was a requirement to have a "C/C++" runtime environment be present.
When I saw the requirement for "C/C++" then I understood the error message stating, "... DLL load failed while importing _cext"
I figured the "_cext" was shorthand for "C extension."
I discovered "pip install msvc-runtime" would provide the "_cext" support.
Ran the "pip" command, and Viola! The RED underline disappeared in PyCharm!
Holy cow! What a journey, right?!