I'm new to python, so I want to try various libraries. However, I don't want to spend time rebuilding the environment by doing something strange. Therefore, I want an environment that does not affect the entire OS even if I do various things, and I am looking for various things.
Use conda for the switching environment. I will try docker next time. This time, we will also introduce a tensorflow environment at the same time.
I don't want to break the mac environment, so First, download the anaconda formula from the following and install it. https://www.continuum.io/downloads
of course,
$ bash Anaconda2-4.3.1-MacOSX-x86_64.sh
But it seems that the minimum environment such as miniconda is fine.
Well, when conda comes in,
$ conda create -n py2tf python=2.7 anaconda
$ source activate py2tf
You can enter the environment with the above source activate.
When entering the environment, characters such as (py2tf) are added to the beginning and can be identified.
(py2tf)$ conda install -c conda-forge tensorflow
(py2tf)$ source deactivate
In the above example, tensorflow is also installed in addition to the 2.7 environment. In addition to tensorflow, there are many that support conda installation. It seems that additional installation is possible with pip etc. even if it is not supported (see the link at the end of the book) What you install in conda does not affect other environments. (Recognition)
Then build 3.5 series
$ conda create -n py3tf python=3.5 anaconda $ source activate py3tf (py3tf)$ conda install -c conda-forge tensorflow (py3tf)$ source deactivate
Enter the environment
$ source activate py3tf
Get out of the environment
(py3tf)$ source deactivate
List of created environment
$ conda info -e
Search for environments in conda
$ conda search tenorflow
update of conda
$ conda update conda
Browse installed packages in your environment
$ conda list
If you run it in an environment, a list of packages in that environment.
If you run it outside the environment, a list of packages included in the mac itself.
Or, execute by specifying the environment
$ conda list -n py3tf
Delete environment
conda remove -n py3tf --all
Export the library installed by conda
And build the environment from the above file
conda list --export > conda_requirements.txt conda create -n my_new_env --file conda_requirements.txt
Is the following environmental output method the mainstream?
Environment output, build environment from output file
conda env export > environment.yml conda env create -f environment.yml
I referred to the following articles. https://gist.github.com/aphlysia/d5fcee79ff81b8272faf http://qiita.com/icoxfog417/items/02a80b93b5f1e95f2795 http://qiita.com/yubessy/items/2dd43551aa8308dc7eca
** For Windows 10 **
Download and install Anaconda from the website. (Executable file format)
PATH to python and conda. By default, it should be installed around the following. 'C:\Users"user name"\Anaconda3' 'C:\Users"user name"\Anaconda3\Scripts'
The rest is the same as for MAC.
Recommended Posts