Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get VirtualEnv TensorFlow to work in PyCharm?

So I installed tensorflow onto my mac through the main response from here: https://stackoverflow.com/a/33691154/6095482

This means that my tensorflow works in a virtualenv. I can run it through my terminal for scripting purposes, but was wondering if there's any way to port that onto an IDE. I am familiar with pycharm, but couldn't figure out the path routing and virtual environments in order to get it going. Does anyone have any advice on where to take this and which IDE would be good?

Thanks!

like image 827
ness_boy Avatar asked May 25 '16 21:05

ness_boy


People also ask

How do I activate TensorFlow in PyCharm?

Click the Python Interpreter tab within your project tab. Click the small + symbol to add a new library to the project. Now type in the library to be installed, in your example "tensorflow" without quotes, and click Install Package . Wait for the installation to terminate and close all popup windows.

How do I enable virtual env in PyCharm?

Press Ctrl+Alt+S to open the IDE settings and select Project <project name> | Python Interpreter. icon and select Show All. Select the target environment from the list and click OK to confirm your choice.

How do I know if PyCharm has TensorFlow installed?

Use python --version and pip --version to get the versions. To test whether your installation works, create a python file named test.py . Copy the following python scripts in test.py and execute it in PyCharm. If it outputs the current tensorflow version, it means that tensorflow is successfully installed.


1 Answers

You have installed tensorflow in a virtualenv, here's how to get PyCharm to use it:

  1. First you want to add that virtualenv you created and installed tensorflow in, as an interpreter in PyCharm. Please follow this guide from PyCharm makers: Adding Existing Virtual Environment You will want to select python executable from your virtualenv forlder, e.g. your_venv/bin/python

  2. Once added as an interpreter you want to select it for your project. Here's a guide: Selecting Python interpreter for a project

like image 176
bakkal Avatar answered Sep 22 '22 06:09

bakkal