I wanted to see the situation graphically rather than doing the popular Tensorflow tutorial, so when I tried to proceed with reference to the following page, I had trouble displaying the image. ..
--Try the TensorFlow tutorial (1) http://www.mwsoft.jp/programming/tensor/tutorial_beginners.html
I reviewed the environment after I could not display the image with pylab. I will leave it as a memorandum.
By the way, one of the reasons why the image could not be displayed was simply because `plt.show ()`
was not done at the end.
Mac OS X El Capitan (10.11)
$ pyenv --version
pyenv 20160509
$ pyenv versions
system
* 2.7.10 (set by /Users/butada/.python-version)
3.4.4
I noticed that I am using the same Python as the OS, even though I am using pyenv.
$ which python
/usr/local/bin/python
After rereading the procedure for building pyenv, There was not enough information in .bash_profile.
eval "$(pyenv init -)" #There was a shortage here
eval "$(pyenv virtualenv-init -)"
The second line was written, but the first line was not. .. This will cause the libraries installed by pip to It was installed on the OS. ..
Change the backend from macosx``` to
`TkAgg``` as you will have backend problems with system Python.
You can find out which file to change by executing the following command.
python -c "import matplotlib;print(matplotlib.matplotlib_fname())"
In my environment it was in the following path.
vi /Users/butada/.pyenv/versions/2.7.10/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc
#backend : macosx # comment out 2017/1/4
backend : TkAgg
This time pyenv did not work and matplotlib was installed on the OS, so I had to install matplotlib after setting pyenv correctly. The installation explanation of matplotlib is omitted.
I ran the code on the following page to check it. http://qiita.com/saj_kz/items/40dbfbb84dabcd2a9b46
** Note: **
If you re-execute `plt.show ()`
every time you close the window
I was wondering if a window would appear,
plt.plot(x,y)I had to start over.
## Check if pyenv is working
It is OK if it is under the home directory instead of ``` / usr / bin``` or `` `/ usr / local / bin``` as shown below.
$ which python /Users/butada/.pyenv/shims/python
## Check if the Python version is switched with pyenv
Make sure pyenv switches the python version.
$ mkdir tensorflow $ cd tensorflow
$ pyenv local 3.4.4 $ python --version Python 3.4.4
$ pyenv local 2.7.10 $ python --version Python 2.7.10
$ pyenv local system $ python --version Python 2.7.10 #Python installed on the OS is the same version, so it's hard to see the changes. ..
You can also check the libraries installed in each.
$ pyenv local 3.4.4 $ pip list
$ pyenv local 2.7.10 $ pip list
$ pyenv local system $ sudo pip list #Since it is an OS, it is not required for list, but sudo is required when installing.
** Note: **
There are three ways to switch versions.
- global
- local
- shell
I'm scared to try global because it was the whole system.
local is reflected under that directory. It looks like you've created a .python_version file to save your settings.
The shell seems to be reflected only in the session of that shell.
Other commands that can be used
- pyenv versions
- pyenv install --list
- pyenv install 3.4.4
```pyenv local system```It seems to revert to the system default python.
# Finally
I don't know how to start using pyenv! Or, I'll come back here and calm down when I'm confused when using virtualenv at the same time.
# reference
--What to do when Python does not switch from the System version with pyenv
http://qiita.com/ta_ta_ta_miya/items/e24394c6b0022405a126
I was saved by the last `` `~ / .bash_profile``` written on this page.
--Environment construction with pyenv and virtualenv
http://qiita.com/Kodaira_/items/feadfef9add468e3a85b
Recommended Posts