Pycharm anaconda import tensor flow library issue

前端 未结 2 1330
独厮守ぢ
独厮守ぢ 2021-01-12 14:57

The following program works well under anaconda from command line interface (I am using Mac OS), but it has errors about cannot import/find tensorflow module from PyCharm (u

相关标签:
2条回答
  • 2021-01-12 15:00

    You need to do these following steps:

    1. Go to settings (ctrl+alt+s or File menu->Settings or alt+f+t)
    2. Under Prject: go to Project Interpreter
    3. Choose the interpreter you'd like to use
    4. Click on the gear button (Right top - next to the interpreter selection)
    5. Click More
    6. Click on the right interpreter for your project again and then on the fifth button on the right:
    7. Click on the + button and add the path for your directory containing init file of this library.

    Hope that this answer helped you

    0 讨论(0)
  • 2021-01-12 15:03

    Under Preferences => Project Interpreter setting, is tensorflow listed among the packages?

    Apparently No (from your screenshots).

    Are there any other python conda installations when you use the drop down on project interpreter? If there are, try those and see what happens. The tensorflow package is definitely in another conda installation.

    From this post on SO:

    conda is the package manager. Anaconda is a set of about a hundred packages including conda, numpy, scipy, ipython notebook, and so on.

    You installed Miniconda, which is a smaller alternative to Anaconda that is just conda and its dependencies (as opposed to Anaconda, which is conda and a bunch of other packages like numpy, scipy, ipython notebook, etc.). Once you have Miniconda, you can easily install Anaconda into it with conda install anaconda.

    So conda is a package manager, Anaconda is a collection of packages and miniconda (emphasis mine) is a light weight alternative to Anaconda.

    You should into setting up a virtualenv to avoid such problems in the future.

    0 讨论(0)
提交回复
热议问题