Python is already on the mac, and I felt like I was doing it, but it's not. There are many situations where you need to switch between 2 and 3 in python. If you want to do python, you can create a conda environment. I don't use virtualenv or docker or anything like that. Only conda from pyenv is used here. conda is enough.
ubuntu
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
mac
brew install pyenv
win doesn't need pyenv. To conda.
ubuntu
bashrc
#pyenv
export PYENV_ROOT=$HOME/.pyenv
export PATH=$PYENV_ROOT/bin:$PATH
eval "$(pyenv init -)"
mac
bashrc
#pyenv
eval "$(pyenv init -)"
pyenv versions
mac linux
pyenv install miniconda3-3.10.1
pyenv global miniconda3-3.10.1
win Download what you like https://www.continuum.io/downloads
bashrc
export PATH="$PYENV_ROOT/versions/miniconda3-3.10.1/bin:$PATH"
conda create -n py35 python=3.5
conda create -n py37 python=3.7
conda info --e
mac linux
source activate py35
win
activate py35
You can use the environment when (py35) is prompted. Sometimes (py35) appears, but I haven't put it in the environment. If you think the movement is strange, deactivate it once to exit the environment and enter again. If it is still strange, uninstall pyenv and re-enter the environment.
I couldn't enter with pip, but I entered with conda.
conda install -c conda-forge keras
#3.1.0 series
conda install -c menpo opencv3=3.1.0 -n [Environment name]
#3.2.0 series
#3 at the time of writing.1.MSER for 0 series_There seems to be a bug in create, 3.2.I wrote that it was fixed at 0, so I wanted to put it back in. But I didn't enter.
#conda install -c conda-forge opencv=3.2.0
conda install -c conda-forge dlib=19.4
conda install scikit-image
conda install -c conda-forge ffmpeg
The build is troublesome. The C ++ environment I created is likely to break. ..
And it doesn't disappear. opencv3 doesn't disappear from conda.
conda list | grep open
opencv3 3.1.0 py35_0 menpo
sudo conda install -c conda-forge opencv -n [environment]
sudo conda uninstall -c menpo opencv -n [environment]
sudo conda uninstall -c menpo opencv3
I don't know.
Switch the environment.
conda uninstall -c conda-forge opencv=3.2.0
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'cv2'
I don't know anymore. Let's leave it for a while.
https://stackoverflow.com/questions/42310099/failed-to-run-conda-install-c-menpo-opencv3-3-2-0-in-windows7/42535587?noredirect=1
opencv
It's hard to build. Enter with pip or conda.
pip install -U opencv-python
Be sure to use -n to name the environment when conda create. If you install without -n, it will be strange.
ImportError: No module named cv2 or ImportError: No module named tensorflow If something goes wrong, let's recreate the environment.
Shortest memo for kernel switching with jupyter
conda create -n py36 python=3.6
source activate py36
conda install -n py36 jupyter opencv
conda install notebook ipykernel
ipython kernel install --user --name py36 --display-name py36
jupyter noteobok
See here.
Solution when kernel switching on Jupyter does not work
Look here and set https://qiita.com/utahkaA/items/ae14623ae81f85bea4f5
If you put both miniconda2 and miniconda3 in pyenv, it's OK. Even if I switched from miniconda3 to python2, it was not displayed in jupyter.
It's a good idea to generate a pass and put the encrypted one in the config file.
...
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 99] Cannot assign requested address
https://stackoverflow.com/questions/27870003/pip-install-please-check-the-permissions-and-owner-of-that-directory A phenomenon that is rarely seen. There are times when it is useless to delete everything under .pyenv and reinsert it.
Like putting owner authority in such an atmosphere
$ sudo chown -R USERNAME /Users/USERNAME/Library/Logs/pip
$ sudo chown -R USERNAME /Users/USERNAME/Library/Caches/pip
--Like putting a user
pip install --user <package name>
Make settings here https://qiita.com/Miggy/items/5466a2c1e968602f3ebe
Output ~ / .jupyter / jupyter_notebook_config.py Set the password to sha1 with ipython, write the contents to jupyter_notebook_config.py or set a little.
After that, it should work if you open the port in each cloud.
For gcp https://towardsdatascience.com/running-jupyter-notebook-in-google-cloud-platform-in-15-min-61e16da34d52
Opencv Note where you are calling from.
import cv2
cv2.__file__
import imp
imp.find_module('cv2')
In my case, I went to see below .pyenv, which was as expected.
https://github.com/jupyter/notebook/issues/2213 http://jupyter-notebook.readthedocs.io/en/latest/security.html https://qiita.com/SaitoTsutomu/items/aee41edf1a990cad5be6
Recommended Posts