If so, this is a way to combine both, your tensorflow code running in a virtual environment used by PyCharm and from command line.
This article assumes you installed Python3 and pip3 already.
First step would be to create a new virtual environment using PyCharms Project Interpreter dialog for your existing project:
The settings symbol on the left upper corner allows you to initiate a new virtual environment creation:
As in the tensorflow installtion guide you should inherit global site-packages:
After the virtual environment is created, I did test it first from using command line:
# optional $ cd ~/tensorflow_pycharm # activate the virtual env $ source ~/tensorflow_pycharm/bin/activate # deactivate the virtual env after your prompt should have changed (tensorflow)$ deactivate
Now its time to define & install the correct tensorflow binary to install as defined in the tensorflow installtion guide. In my case it would be:
$ cd ~/tensorflow_pycharm $ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp34-cp34m-linux_x86_64.whl $ sudo pip3 install --upgrade $TF_BINARY_URL
This virtual environment can then be used in a PyCharm project run configuration:
Select the just created virtual environment in case it is not preselected yet:
No you are ready to run your script via virtual environment from both, PyCharm and command line:
- command line: