Skip to content

Instantly share code, notes, and snippets.

@gembin
Last active August 29, 2022 19:14
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gembin/634b4f462766a8a79c3035a85bbcd7a7 to your computer and use it in GitHub Desktop.
Save gembin/634b4f462766a8a79c3035a85bbcd7a7 to your computer and use it in GitHub Desktop.
Installing Tensorflow on Pycharm (Mac)
  • In Pycharm, Preferences -> Project Interpreter -> Create VirtualEnv -> <your_virtualenv_name_and_location>, and select "inherit global site-packages" option -> OK.
  • In command line, install tensorflow in the virtualenv location you created in previous step. For the above case, let's assume the location is ~/tensorflow_pycharm, therefore, run command virtualenv --system-site-packages -p python3 ~/tensorflow_pycharm or python3 -m venv ~/tensorflow_pycharm(changed in version 3.5: the use of venv is now recommended for creating virtual environments).
  • Install tensorflow with one of the following approaches:
    • From command line
      • Activate the virtualenv environment by issuing one of the following commands: source ~/tensorflow_pycharm/bin/activate
      • Issue the following command to install TensorFlow and all the packages that TensorFlow requires into the active Virtualenv environment: pip3 install --upgrade tensorflow.
      • In PyCharm, select the configured Project Interpreter at ~/tensorflow_pycharm
    • From PyCharm
      • In PyCharm, select the previously created Project Interpreter (~/tensorflow_pycharm), and click + button and search for tensorflow, and then double click to install the package.
  • Now you are ready to play with tensorflow from PyCharm.
@HanyHossny
Copy link

This guide is awesome. it helped a lot! thank you :)

@efengx
Copy link

efengx commented Sep 17, 2018

easy to understand. thank

@Cpicon
Copy link

Cpicon commented Sep 30, 2018

when i a trying use the command line with 👍

pip3 install --upgrade tensorflow.

the shell cmd says

Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow

Also, i tried

pip install --upgrade tensorflow

could you tell me what am i doing wrong, please!!
Thank you so much

@gembin
Copy link
Author

gembin commented Oct 8, 2018

@micolsi probably you are using python 3.7, see this issue tensorflow/tensorflow#20444

@gembin
Copy link
Author

gembin commented Oct 8, 2018

@micolsi you can downgrade to python 3.6

# Install the latest Python 3.6 via brew using its commit id
brew unlink python
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb

# switch among different versions if needed
brew switch python 3.7.0
brew switch python 3.6.5_1

@ShenoyVaradaraya
Copy link

best guide to install Tensorflow on Mac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment