0%

安装tensorflow和OpenCV

2018年7月9日 下午4:05

方式一:通过Navigator创建穿件,失败



点击launch jupyter之后,启动报错。
注:我不知道原因和如何解决

方式二:通过命令行的方式进行创建环境和安装包 成功

  1. 当我们通过conda安装多个环境时,如何在各个环境中进行切换?
    1. source activate ***(自己起的环境名)
    2. 判断切换成功python --version
    3. 使用Anaconda管理多个版本的Python环境_百度经验
    4. 【Anaconda】conda环境管理和包管理 - CSDN博客
      1
      2
      3
      4
      5
      6
      7
      localhost:~ czh$ source activate python36
      (python36) localhost:~ czh$ python -V
      Python 3.6.4 :: Anaconda, Inc.
      (python36) localhost:~ czh$ source activate root
      (root) localhost:~ czh$ python -V
      Python 3.6.3 :: Anaconda custom (x86_64)
      (root) localhost:~ czh$
  2. 创建环境的python36环境的操作
    1. Python安装
  3. 如何使用国内的源?
    1. 用pip安装tensorflow换成国内源快速安装 - CSDN博客
    2. pip install --index-url https://pypi.douban.com/simple tensorflow
  4. 启动jupytor notebook
    1. 通过launch键来启动,可以直接打开浏览器
  5. 安装tensorflow和openCV的过程。

注:我们的操作命令要切换到python36下,切换方式open Terminal,出现(/Users/czh/anaconda3/envs/python36)

install tensorflow
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
(/Users/czh/anaconda3/envs/python36) pip install --index-url https://pypi.douban.com/simple tensorflow
Collecting tensorflow
Downloading https://pypi.doubanio.com/packages/03/ad/d732a5d9d50bfcd8aeb6e4a266065a8868829388e4e2b529ff689f1fc923/tensorflow-1.8.0-cp36-cp36m-macosx_10_11_x86_64.whl (46.5MB)
100% |████████████████████████████████| 46.5MB 1.7MB/s
Collecting protobuf>=3.4.0 (from tensorflow)
Downloading https://pypi.doubanio.com/packages/6d/7e/51c91b28cb8446ebd7231d375a2025bca4c59d15ddc0cf2dd0867b400cd7/protobuf-3.6.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (1.2MB)
100% |████████████████████████████████| 1.2MB 2.7MB/s
Requirement already satisfied: numpy>=1.13.3 in ./anaconda3/lib/python3.6/site-packages (from tensorflow)
Collecting grpcio>=1.8.6 (from tensorflow)
Downloading https://pypi.doubanio.com/packages/7e/a9/daef33ec8a83eb1c34498f947d4447d5728d91c7374e4b78465c7c14e99a/grpcio-1.13.0-cp36-cp36m-macosx_10_7_intel.whl (1.9MB)
100% |████████████████████████████████| 1.9MB 1.9MB/s
Collecting absl-py>=0.1.6 (from tensorflow)
Downloading https://pypi.doubanio.com/packages/57/8d/6664518f9b6ced0aa41cf50b989740909261d4c212557400c48e5cda0804/absl-py-0.2.2.tar.gz (82kB)
100% |████████████████████████████████| 92kB 2.2MB/s
Collecting tensorboard<1.9.0,>=1.8.0 (from tensorflow)
Downloading https://pypi.doubanio.com/packages/59/a6/0ae6092b7542cfedba6b2a1c9b8dceaf278238c39484f3ba03b03f07803c/tensorboard-1.8.0-py3-none-any.whl (3.1MB)
100% |████████████████████████████████| 3.1MB 1.3MB/s
Requirement already satisfied: wheel>=0.26 in ./anaconda3/lib/python3.6/site-packages (from tensorflow)
Collecting termcolor>=1.1.0 (from tensorflow)
Downloading https://pypi.doubanio.com/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
Collecting gast>=0.2.0 (from tensorflow)
Downloading https://pypi.doubanio.com/packages/5c/78/ff794fcae2ce8aa6323e789d1f8b3b7765f601e7702726f430e814822b96/gast-0.2.0.tar.gz
Requirement already satisfied: six>=1.10.0 in ./anaconda3/lib/python3.6/site-packages (from tensorflow)
Collecting astor>=0.6.0 (from tensorflow)
Downloading https://pypi.doubanio.com/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl
Requirement already satisfied: setuptools in ./anaconda3/lib/python3.6/site-packages (from protobuf>=3.4.0->tensorflow)
Collecting bleach==1.5.0 (from tensorboard<1.9.0,>=1.8.0->tensorflow)
Downloading https://pypi.doubanio.com/packages/33/70/86c5fec937ea4964184d4d6c4f0b9551564f821e1c3575907639036d9b90/bleach-1.5.0-py2.py3-none-any.whl
Collecting markdown>=2.6.8 (from tensorboard<1.9.0,>=1.8.0->tensorflow)
Downloading https://pypi.doubanio.com/packages/6d/7d/488b90f470b96531a3f5788cf12a93332f543dbab13c423a5e7ce96a0493/Markdown-2.6.11-py2.py3-none-any.whl (78kB)
100% |████████████████████████████████| 81kB 1.9MB/s
Collecting html5lib==0.9999999 (from tensorboard<1.9.0,>=1.8.0->tensorflow)
Downloading https://pypi.doubanio.com/packages/ae/ae/bcb60402c60932b32dfaf19bb53870b29eda2cd17551ba5639219fb5ebf9/html5lib-0.9999999.tar.gz (889kB)
100% |████████████████████████████████| 890kB 780kB/s
Requirement already satisfied: werkzeug>=0.11.10 in ./anaconda3/lib/python3.6/site-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow)
Building wheels for collected packages: absl-py, termcolor, gast, html5lib
Running setup.py bdist_wheel for absl-py ... done
Stored in directory: /Users/czh/Library/Caches/pip/wheels/e0/44/a0/07113cecc5dbc4cee558d42d5a34b15d9a5787df6ea931937d
Running setup.py bdist_wheel for termcolor ... done
Stored in directory: /Users/czh/Library/Caches/pip/wheels/15/b4/7c/713366bcd4e4f6d38377a66e0742bd15e6920b1939be008dbb
Running setup.py bdist_wheel for gast ... done
Stored in directory: /Users/czh/Library/Caches/pip/wheels/c8/36/31/f4b2d78e77afcf43d99fa2b240e8bcd15fcc4b00ef6d2ed224
Running setup.py bdist_wheel for html5lib ... done
Stored in directory: /Users/czh/Library/Caches/pip/wheels/f1/96/75/2a2fe430e950c2085529db17027515501b5d3c6632e4d85e29
Successfully built absl-py termcolor gast html5lib
Installing collected packages: protobuf, grpcio, absl-py, html5lib, bleach, markdown, tensorboard, termcolor, gast, astor, tensorflow
Found existing installation: html5lib 0.999999999
Uninstalling html5lib-0.999999999:
Successfully uninstalled html5lib-0.999999999
Found existing installation: bleach 2.0.0
Uninstalling bleach-2.0.0:
Successfully uninstalled bleach-2.0.0
Successfully installed absl-py-0.2.2 astor-0.7.1 bleach-1.5.0 gast-0.2.0 grpcio-1.13.0 html5lib-0.9999999 markdown-2.6.11 protobuf-3.6.0 tensorboard-1.8.0 tensorflow-1.8.0 termcolor-1.1.0

install opencv-python
1
2
3
4
5
6
7
(/Users/czh/anaconda3/envs/python36) pip install --index-url https://pypi.douban.com/simple opencv-python
Collecting opencv-python
Downloading https://pypi.doubanio.com/packages/e1/4a/7b9821af03b70b45946cf597cfcfc30e3025257fb0c4c350b2e9d693ef7d/opencv_python-3.4.1.15-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (41.9MB)
100% |████████████████████████████████| 41.9MB 2.0MB/s
Requirement already satisfied: numpy>=1.11.3 in ./anaconda3/lib/python3.6/site-packages (from opencv-python)
Installing collected packages: opencv-python
Successfully installed opencv-python-3.4.1.15