PyCharm import external library

前端 未结 7 1789
广开言路
广开言路 2020-11-27 13:22

I am using PyCharm as an editor for python code in Houdini. Whenever I try to import the main Houdini library (hou) I get an error flagged in PyCharm. If I include the code

7条回答
  •  孤城傲影
    2020-11-27 14:04

    Answer for PyCharm 2016.1 on OSX: (This is an update to the answer by @GeorgeWilliams993's answer above, but I don't have the rep yet to make comments.)

    Go to Pycharm menu --> Preferences --> Project: (projectname) --> Project Interpreter

    At the top is a popup for "Project Interpreter," and to the right of it is a button with ellipses (...) - click on this button for a different popup and choose "More" (or, as it turns out, click on the main popup and choose "Show All").

    This shows a list of interpreters, with one selected. At the bottom of the screen are a set of tools... pick the rightmost one:

    Now you should see all the paths pycharm is searching to find imports, and you can use the "+" button at the bottom to add a new path.

    I think the most significant difference from @GeorgeWilliams993's answer is that the gear button has been replaced by a set of ellipses. That threw me off.

提交回复
热议问题