Installing tensorflow on Pycharm (Mac)

前端 未结 5 756
攒了一身酷
攒了一身酷 2020-12-31 17:33

I was trying to use tensorflow in Pycharm IDE.

It seems that in Pycharm, it is one-click to install a package. It was very easy with bumpy. Now error occurs when I w

相关标签:
5条回答
  • 2020-12-31 17:38

    To summarize (on Mac) :

    Step 1, get latest Python (2.7.11 today) on Pycharm: Pycharm, can not find Python version 2.7.11

    Step 2, follow "Pip Installation" of https://www.tensorflow.org/versions/r0.8/get_started/os_setup.html#download-and-setup

    Step 3, Pycharm-- preference -- project interpreter, install the latest versions of numpy, protobuf, six. Tensorflow import error on Pycharm (Mac) Note, maybe have to click the "specify version" when installing.

    Step 4, Pycharm-- preference -- project interpreter, install the latest version of tensorflow (v 0.8.0 today). Note, if not find v0.8.0, then maybe have to manually click "Manage Repositories" and then add the link of Step 2 (https://storage.googleapis.com/tensorflow/mac/tensorflow-0.8.0-py2-none-any.whl)

    These steps worked well on both Mac computers of mine. Thanks for all helps during the procedure from contributors.

    0 讨论(0)
  • 2020-12-31 17:47

    Go Preferences and search for the interpreter. You may see several interpreters. Select any interpreter which has the tensorflow package installed.

    Check out the installed packages and double check the versions of tensorflow as shown in this picture.

    0 讨论(0)
  • 2020-12-31 17:51

    Update - Nov. 1, 2017:

    Tried successfully with Latest Jetbrain PyCharm Community Edition (2017.2.4) and Python 2.7.14, with Installing with virtualenv of https://www.tensorflow.org/install/install_mac.

    Install tensorflow with virtualenv

    Add Local to Project Interpreter.

    Run the script

    Generate graph

    Run tensorboard --logdir=/tmp/tensorflow_logs in Terminal of PyCharm

    0 讨论(0)
  • 2020-12-31 18:02

    Steps I followed 1. Use the virtualenv option in tensor flow's official guide for installation and follow the steps exactly to install and set up tensor flow. Although we've already created a virtual environment here, I created a separate one for Pycharm projects.

    This is how you do it. 1. Create a new project. Go to Preferences. Go to interpreter and create a new virtualEnv. Give it a name and check on the box "inherit global site-packages". Press "OK". creating a virtualenv

    1. Below are a list of Packages. Here's where I couldn't find tensor flow initially. If this is the case, there's a + symbol on the bottom left. Click on it and manually search for "tensorflow". Click on "install package" on the bottom left. installing tensorflow package After the installation is done press OK.Close this screen. Tensorflow will now appear on the installed packages list. Press ok. Now test your installation with a program.

      import tensorflow as tf
      hello = tf.constant("hello TF")
      sess = tf.Session()
      print(sess.run(hello))
      

    Hope this helps.

    0 讨论(0)
  • 2020-12-31 18:04

    If you install tensorflow with the virtualenv option and want to use it from Pycharm for a project, you need to set up a corresponding virtualenv interpreter. There are a few solutions on the forum, for example How to get VirtualEnv TensorFlow to work in PyCharm?, however, that one didn't work for me with a "python packaging tools not found pycharm" error.

    This is a working solution for me, first create a virtualenv from Pycharm and then install tensorflow there:

    1. In Pycharm, Preferences -> Project interpreter -> Create VirtualEnv -> give the virtualenv a name and location of your choice, and select "inherit global site-packages" option -> OK.
    2. In command line, install tensorflow in the virtualenv location you created in Step 1. For the above case, the location is ~/tensorflow_pycharm, therefore, run command virtualenv --system-site-packages ~/tensorflow_pycharm

    3. In Pycharm, select the created project interpreter, and select the tensorflow package, double click to install the package.

    4. If Step 3 is successful, set run configuration, and try run a sample program.

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