Anaconda使用(2)

2017-06-18 & 2017-07-05

今天来聊聊Anaconda虚拟环境的安装。

先把官网的参考链接给出来:http://ipython.readthedocs.io/en/stable/install/kernel_install.html

conda cheatsheet: http://conda.pydata.org/docs/_downloads/conda-cheatsheet.pdf

  • 终端运行以下代码:

假设你已经安装了anaconda3(python3)版本,然后想安装python2内核。

conda create -n py2 python=2 ipykernel
source activate py2   # On Windows, remove the word 'source'
python -m ipykernel install --user
  • 以下为具体的步骤描述:
    1. 显示可安装的python版本 conda search -f python.
    2. 安装虚拟环境,名称为py2, 注意需要同时安装ipykernel: conda create -n py2 python=2.7 ipykernel
    3. 激活py2 source activate py2, windows系统请使用activate py2
    4. 然后安装一些常用的包conda install numpy, pandas
    5. 把py2添加到notebook内核里 python -m ipykernel install --user
  • 注意事项:
IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
    When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
    Beginning with IPython 6.0, Python 3.3 and above is required.

    See IPython `README.rst` file for more information:

        https://github.com/ipython/ipython/blob/master/README.rst

    Python sys.version_info(major=2, minor=7, micro=13, releaselevel='final', serial=0) detected.

# 若忘记在第一步conda安装ipykernel
# 下面需要制定ipykernel的版本
conda create -n py2 python=2.7
source activate py2
python -m pip install ipykernel==4.5
python -m ipykernel install --user
deactivate py2
jupyter notebook
# Mac认证
sudo xcodebuild -license 
# 输入agree
conda create -n py2 python=2.7
source activate py2
python -m pip install ipython==5 # 不知道这个步骤是否需要
python -m pip install ipykernel==4.5
python -m ipykernel install --user
deactivate py2
jupyter notebook

纠结的安装过程

lvmingzhideMacBook-Pro:~ lvmingzhi$ conda create -n py2 python=2.7
Fetching package metadata ...........
Solving package specifications: .

Package plan for installation in environment /Users/lvmingzhi/anaconda/envs/py2:

The following NEW packages will be INSTALLED:

    openssl:    1.0.2l-0      https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    pip:        9.0.1-py27_1  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    python:     2.7.13-0      https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    readline:   6.2-2         https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    setuptools: 27.2.0-py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    sqlite:     3.13.0-0      https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    tk:         8.5.18-0      https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    wheel:      0.29.0-py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    zlib:       1.2.8-3       https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

Proceed ([y]/n)? y

openssl-1.0.2l 100% |#######################################################################################################| Time: 0:00:40  78.05 kB/s
readline-6.2-2 100% |#######################################################################################################| Time: 0:00:03  75.95 kB/s
sqlite-3.13.0- 100% |#######################################################################################################| Time: 0:00:21  66.38 kB/s
tk-8.5.18-0.ta 100% |#######################################################################################################| Time: 0:00:28  71.96 kB/s
zlib-1.2.8-3.t 100% |#######################################################################################################| Time: 0:00:00 140.50 kB/s
python-2.7.13- 100% |#######################################################################################################| Time: 0:01:35 100.41 kB/s
setuptools-27. 100% |#######################################################################################################| Time: 0:00:22  23.95 kB/s
wheel-0.29.0-p 100% |#######################################################################################################| Time: 0:00:15   5.25 kB/s
pip-9.0.1-py27 100% |#######################################################################################################| Time: 0:00:39  41.31 kB/s

    #
    # To activate this environment, use:
    # > source activate py2
    #
    # To deactivate this environment, use:
    # > source deactivate py2
    #

lvmingzhideMacBook-Pro:~ lvmingzhi$ source activate py2
(py2) lvmingzhideMacBook-Pro:~ lvmingzhi$ which py2
(py2) lvmingzhideMacBook-Pro:~ lvmingzhi$ python -m ipykernel install --user
/Users/lvmingzhi/anaconda/envs/py2/bin/python: No module named ipykernel
(py2) lvmingzhideMacBook-Pro:~ lvmingzhi$ python -m pip install ipykernel
Collecting ipykernel
  Downloading http://mirrors.aliyun.com/pypi/packages/d8/75/f3e73209d2a9194403655b4e5e4dc0a698b789de31e672cc03afed64d17a/ipykernel-4.6.1-py2-none-any.whl (104kB)
    100% |████████████████████████████████| 112kB 308kB/s
Collecting tornado>=4.0 (from ipykernel)
  Downloading http://mirrors.aliyun.com/pypi/packages/df/42/a180ee540e12e2ec1007ac82a42b09dd92e5461e09c98bf465e98646d187/tornado-4.5.1.tar.gz (483kB)
    100% |████████████████████████████████| 491kB 1.3MB/s
Collecting jupyter-client (from ipykernel)
  Downloading http://mirrors.aliyun.com/pypi/packages/ab/f5/57a8d68eef68a7bec68a75cd1ef6e9d455c66106c65bf3ba37cb626ecebb/jupyter_client-5.0.1-py2.py3-none-any.whl (83kB)
    100% |████████████████████████████████| 92kB 123kB/s
Collecting ipython>=4.0.0 (from ipykernel)
  Downloading http://mirrors.aliyun.com/pypi/packages/79/63/b671fc2bf0051739e87a7478a207bbeb45cfae3c328d38ccdd063d9e0074/ipython-6.1.0.tar.gz (5.1MB)
    100% |████████████████████████████████| 5.1MB 70kB/s
    Complete output from command python setup.py egg_info:

    IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
    When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
    Beginning with IPython 6.0, Python 3.3 and above is required.

    See IPython `README.rst` file for more information:

        https://github.com/ipython/ipython/blob/master/README.rst

    Python sys.version_info(major=2, minor=7, micro=13, releaselevel='final', serial=0) detected.



    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/nj/6h8mlh517r79dwgq9_sfx9lr0000gn/T/pip-build-jaD6pt/ipython/


(py2) lvmingzhideMacBook-Pro:~ lvmingzhi$ which python
/Users/lvmingzhi/anaconda/envs/py2/bin/python

(py2) lvmingzhideMacBook-Pro:~ lvmingzhi$ pip install --upgrade setuptools
Collecting setuptools
  Downloading http://mirrors.aliyun.com/pypi/packages/fc/cb/748dcabb152fbc7eceaf585d052b8bc11cf028b917a7d2343cf1e0c092c3/setuptools-36.0.1-py2.py3-none-any.whl (476kB)
    100% |████████████████████████████████| 481kB 4.0MB/s
Installing collected packages: setuptools
  Found existing installation: setuptools 27.2.0
    Uninstalling setuptools-27.2.0:
      Successfully uninstalled setuptools-27.2.0
Successfully installed setuptools-36.0.1
Traceback (most recent call last):
  File "/Users/lvmingzhi/anaconda/envs/py2/bin/pip", line 6, in <module>
    sys.exit(pip.main())
  File "/Users/lvmingzhi/anaconda/envs/py2/lib/python2.7/site-packages/pip/__init__.py", line 249, in main
    return command.main(cmd_args)
  File "/Users/lvmingzhi/anaconda/envs/py2/lib/python2.7/site-packages/pip/basecommand.py", line 252, in main
    pip_version_check(session)
  File "/Users/lvmingzhi/anaconda/envs/py2/lib/python2.7/site-packages/pip/utils/outdated.py", line 102, in pip_version_check
    installed_version = get_installed_version("pip")
  File "/Users/lvmingzhi/anaconda/envs/py2/lib/python2.7/site-packages/pip/utils/__init__.py", line 838, in get_installed_version
    working_set = pkg_resources.WorkingSet()
  File "/Users/lvmingzhi/anaconda/envs/py2/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 644, in __init__
    self.add_entry(entry)
  File "/Users/lvmingzhi/anaconda/envs/py2/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 700, in add_entry
    for dist in find_distributions(entry, True):
  File "/Users/lvmingzhi/anaconda/envs/py2/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1949, in find_eggs_in_zip
    if metadata.has_metadata('PKG-INFO'):
  File "/Users/lvmingzhi/anaconda/envs/py2/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1463, in has_metadata
    return self.egg_info and self._has(self._fn(self.egg_info, name))
  File "/Users/lvmingzhi/anaconda/envs/py2/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1823, in _has
    return zip_path in self.zipinfo or zip_path in self._index()
  File "/Users/lvmingzhi/anaconda/envs/py2/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1703, in zipinfo
    return self._zip_manifests.load(self.loader.archive)
  File "/Users/lvmingzhi/anaconda/envs/py2/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 1643, in load
    mtime = os.stat(path).st_mtime
OSError: [Errno 2] No such file or directory: '/Users/lvmingzhi/anaconda/envs/py2/lib/python2.7/site-packages/setuptools-27.2.0-py2.7.egg'




(py2) lvmingzhideMacBook-Pro:~ lvmingzhi$ python -m pip install ipykernel==999999
Collecting ipykernel==999999
  Could not find a version that satisfies the requirement ipykernel==999999 (from versions: 4.0.1, 4.0.2, 4.0.3, 4.1.0, 4.1.1, 4.2.0, 4.2.1, 4.2.2, 4.3.0, 4.3.1, 4.4.0, 4.4.1, 4.5.0, 4.5.1, 4.5.2, 4.6.0, 4.6.1)
No matching distribution found for ipykernel==999999




(py2) lvmingzhideMacBook-Pro:~ lvmingzhi$ pip install ipython==5
Collecting ipython==5
  Downloading http://mirrors.aliyun.com/pypi/packages/eb/b6/3ed54fe22c284108d9676029b7cdca0ce94bcb8dc24487af0c88d57c53a1/ipython-5.0.0-py2.py3-none-any.whl (743kB)
    100% |████████████████████████████████| 747kB 1.5MB/s
Requirement already satisfied: setuptools>=18.5 in ./anaconda/envs/py2/lib/python2.7/site-packages (from ipython==5)
Collecting backports.shutil-get-terminal-size; python_version == "2.7" (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/7d/cd/1750d6c35fe86d35f8562091737907f234b78fdffab42b29c72b1dd861f4/backports.shutil_get_terminal_size-1.0.0-py2.py3-none-any.whl
Collecting pickleshare (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/9f/17/daa142fc9be6b76f26f24eeeb9a138940671490b91cb5587393f297c8317/pickleshare-0.7.4-py2.py3-none-any.whl
Collecting simplegeneric>0.8 (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/3d/57/4d9c9e3ae9a255cd4e1106bb57e24056d3d0709fc01b2e3e345898e49d5b/simplegeneric-0.8.1.zip
Collecting decorator (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/00/cc/dd79ea98a0ff5a01d714c37eddd99cd0a71557113f1511921d1ef9a083b8/decorator-4.0.11-py2.py3-none-any.whl
Collecting pexpect; sys_platform != "win32" (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/5b/16/4859a0376be8b87bf3920b1f6e63b8a3c0ee42488babee07c87ca9316e03/pexpect-4.2.1-py2.py3-none-any.whl (55kB)
    100% |████████████████████████████████| 61kB 839kB/s
Collecting pathlib2; python_version == "2.7" or python_version == "3.3" (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/74/4e/68add57f8b993bb5da70c22c7eebb4266c7b66cab15095a1578cc6a62b1a/pathlib2-2.3.0-py2.py3-none-any.whl
Collecting pygments (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/02/ee/b6e02dc6529e82b75bb06823ff7d005b141037cb1416b10c6f00fc419dca/Pygments-2.2.0-py2.py3-none-any.whl (841kB)
    100% |████████████████████████████████| 849kB 941kB/s
Collecting traitlets>=4.2 (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/93/d6/abcb22de61d78e2fc3959c964628a5771e47e7cc60d53e9342e21ed6cc9a/traitlets-4.3.2-py2.py3-none-any.whl (74kB)
    100% |████████████████████████████████| 81kB 1.1MB/s
Collecting prompt-toolkit<2.0.0,>=1.0.3 (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/4b/85/58829b76140b81b30d2d455040808665b2041b923134a287643b684de4e3/prompt_toolkit-1.0.14-py2-none-any.whl (248kB)
    100% |████████████████████████████████| 256kB 1.4MB/s
Collecting appnope; sys_platform == "darwin" (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/87/a9/7985e6a53402f294c8f0e8eff3151a83f1fb901fa92909bb3ff29b4d22af/appnope-0.1.0-py2.py3-none-any.whl
Collecting ptyprocess>=0.5 (from pexpect; sys_platform != "win32"->ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/40/a5/184b46a3c986000196abd077166b2536acb2500009bec95feb9b8fc19828/ptyprocess-0.5.1-py2.py3-none-any.whl
Collecting scandir; python_version < "3.5" (from pathlib2; python_version == "2.7" or python_version == "3.3"->ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/bd/f4/3143e0289faf0883228017dbc6387a66d0b468df646645e29e1eb89ea10e/scandir-1.5.tar.gz
Collecting six (from pathlib2; python_version == "2.7" or python_version == "3.3"->ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/c8/0a/b6723e1bc4c516cb687841499455a8505b44607ab535be01091c0f24f079/six-1.10.0-py2.py3-none-any.whl
Collecting ipython-genutils (from traitlets>=4.2->ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl
Collecting enum34; python_version == "2.7" (from traitlets>=4.2->ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/c5/db/e56e6b4bbac7c4a06de1c50de6fe1ef3810018ae11732a50f15f62c7d050/enum34-1.1.6-py2-none-any.whl
Collecting wcwidth (from prompt-toolkit<2.0.0,>=1.0.3->ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/7e/9f/526a6947247599b084ee5232e4f9190a38f398d7300d866af3ab571a5bfe/wcwidth-0.1.7-py2.py3-none-any.whl
Building wheels for collected packages: simplegeneric, scandir
  Running setup.py bdist_wheel for simplegeneric ... done
  Stored in directory: /Users/lvmingzhi/Library/Caches/pip/wheels/d5/a7/fa/74826c1be8943e04df2d804ae74db1d99573205d06bfdb0ba9
  Running setup.py bdist_wheel for scandir ... error
  Complete output from command /Users/lvmingzhi/anaconda/envs/py2/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/nj/6h8mlh517r79dwgq9_sfx9lr0000gn/T/pip-build-eg2Fxc/scandir/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/nj/6h8mlh517r79dwgq9_sfx9lr0000gn/T/tmptRQfA3pip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.7-x86_64-2.7
  copying scandir.py -> build/lib.macosx-10.7-x86_64-2.7
  running build_ext
  building '_scandir' extension
  creating build/temp.macosx-10.7-x86_64-2.7
  gcc -fno-strict-aliasing -I/Users/lvmingzhi/anaconda/envs/py2/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/lvmingzhi/anaconda/envs/py2/include/python2.7 -c _scandir.c -o build/temp.macosx-10.7-x86_64-2.7/_scandir.o


  Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.


  error: command 'gcc' failed with exit status 69

  ----------------------------------------
  Failed building wheel for scandir
  Running setup.py clean for scandir
Successfully built simplegeneric
Failed to build scandir
Installing collected packages: backports.shutil-get-terminal-size, scandir, six, pathlib2, pickleshare, simplegeneric, decorator, ptyprocess, pexpect, pygments, ipython-genutils, enum34, traitlets, wcwidth, prompt-toolkit, appnope, ipython
  Running setup.py install for scandir ... error
    Complete output from command /Users/lvmingzhi/anaconda/envs/py2/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/nj/6h8mlh517r79dwgq9_sfx9lr0000gn/T/pip-build-eg2Fxc/scandir/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/nj/6h8mlh517r79dwgq9_sfx9lr0000gn/T/pip-iawHrP-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-2.7
    copying scandir.py -> build/lib.macosx-10.7-x86_64-2.7
    running build_ext
    building '_scandir' extension
    creating build/temp.macosx-10.7-x86_64-2.7
    gcc -fno-strict-aliasing -I/Users/lvmingzhi/anaconda/envs/py2/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/lvmingzhi/anaconda/envs/py2/include/python2.7 -c _scandir.c -o build/temp.macosx-10.7-x86_64-2.7/_scandir.o


    Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.


    error: command 'gcc' failed with exit status 69

    ----------------------------------------
Command "/Users/lvmingzhi/anaconda/envs/py2/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/nj/6h8mlh517r79dwgq9_sfx9lr0000gn/T/pip-build-eg2Fxc/scandir/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/nj/6h8mlh517r79dwgq9_sfx9lr0000gn/T/pip-iawHrP-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/nj/6h8mlh517r79dwgq9_sfx9lr0000gn/T/pip-build-eg2Fxc/scandir/





(py2) lvmingzhideMacBook-Pro:~ lvmingzhi$ sudo xcodebuild -license
Password:


    You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.
    Hit the Enter key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'
    Apple Inc.
    Xcode and Apple SDKs Agreement
    PLEASE SCROLL DOWN AND READ ALL OF THE FOLLOWING TERMS AND CONDITIONS CAREFULLY BEFORE USING THE APPLE SOFTWARE OR APPLE SERVICES.  THIS IS A LEGAL AGREEMENT BETWEEN YOU AND APPLE.  IF YOU AGREE TO BE BOUND BY ALL OF THE TERMS AND CONDITIONS, CLICK THE “AGREE” BUTTON.  BY CLICKING “AGREE” OR BY DOWNLOADING, USING OR COPYING ANY PART OF THIS APPLE SOFTWARE OR USING ANY PART OF THE APPLE SERVICES, YOU ARE AGREEING ON YOUR OWN BEHALF AND/OR ON BEHALF OF YOUR COMPANY OR ORGANIZATION TO THE TERMS AND CONDITIONS STATED BELOW.  IF YOU DO NOT OR CANNOT AGREE TO THE TERMS OF THIS AGREEMENT, YOU CANNOT USE THIS APPLE SOFTWARE OR THE APPLE SERVICES.  DO NOT DOWNLOAD OR USE THIS APPLE SOFTWARE OR APPLE SERVICES IN THAT CASE.

    1.      Definitions
    Whenever capitalized in this Agreement:
    “Agreement” means this Xcode and Apple SDKs Agreement.
    “Apple” means Apple Inc., a California corporation with its principal place of business at One Infinite Loop, Cupertino, California 95014, U.S.A.
    “Apple Developer Program License Agreement” means a separate agreement that may be entered into between You and Apple regarding the development and submission of Applications to the App Store for approval and digital signing by Apple, development of libraries for iOS, watchOS, and/or tvOS, and the use of Apple services such as the Apple Push Notification Service, In-App Purchase, and iCloud, among other things.
    “Apple Maps Service” means the mapping platform and Map Data provided by Apple via the MapKit API (which is the documented API that enables You to add mapping features or functionality to Applications).
    “Apple Services” or “Services” means the developer services that Apple provides to You under this Agreement solely for use with Your Applications and not for use by You as an end-user (e.g., Game Center, Apple Maps Service, any Apple-certificate issuance services, etc.), including any Updates thereto (if any) that may be provided to You by Apple.
    “Apple Software” means the Xcode Developer Tools and the Apple SDKs, including any Updates thereto (if any) that may be provided to You by Apple.
    “Apple SDKs” means the macOS SDK, and the Apple-proprietary Software Development Kits (SDKs) provided hereunder, including but not limited to header files, APIs, libraries, simulators, and software (source code and object code) labeled as part of the iOS SDK, watchOS SDK and/or tvOS SDK and included in the Xcode Developer Tools package for purposes of targeting Apple-branded products running iOS, watchOS, or tvOS.
    “Application” means a software program (including extensions and media that are enclosed in a single software bundle) developed by You hereunder, for use under Your own name, trademark or brand, and specifically for use on Apple-branded products running macOS, iOS, watchOS, tvOS, as applicable, including new releases and new versions of such software program, but excluding libraries for iOS, watchOS, or tvOS applications.
    For clarity, the term Application as used in this Agreement excludes libraries that are for use in Applications designed for iOS, watchOS, or tvOS.  Such libraries can be developed by You only under the terms of the Apple Developer Program License Agreement.
    By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel] 

    ——————输入:agree

    You can view the license agreements in Xcode\'s About Box, or at /Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf


(py2) lvmingzhideMacBook-Pro:~ lvmingzhi$ python -m pip install ipython==5
Collecting ipython==5
  Downloading http://mirrors.aliyun.com/pypi/packages/eb/b6/3ed54fe22c284108d9676029b7cdca0ce94bcb8dc24487af0c88d57c53a1/ipython-5.0.0-py2.py3-none-any.whl (743kB)
    100% |████████████████████████████████| 747kB 855kB/s
Requirement already satisfied: setuptools>=18.5 in ./anaconda/envs/py2/lib/python2.7/site-packages (from ipython==5)
Requirement already satisfied: backports.shutil-get-terminal-size; python_version == "2.7" in ./anaconda/envs/py2/lib/python2.7/site-packages (from ipython==5)
Collecting pickleshare (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/9f/17/daa142fc9be6b76f26f24eeeb9a138940671490b91cb5587393f297c8317/pickleshare-0.7.4-py2.py3-none-any.whl
Collecting simplegeneric>0.8 (from ipython==5)
Collecting decorator (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/00/cc/dd79ea98a0ff5a01d714c37eddd99cd0a71557113f1511921d1ef9a083b8/decorator-4.0.11-py2.py3-none-any.whl
Collecting pexpect; sys_platform != "win32" (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/5b/16/4859a0376be8b87bf3920b1f6e63b8a3c0ee42488babee07c87ca9316e03/pexpect-4.2.1-py2.py3-none-any.whl (55kB)
    100% |████████████████████████████████| 61kB 1.9MB/s
Collecting pathlib2; python_version == "2.7" or python_version == "3.3" (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/74/4e/68add57f8b993bb5da70c22c7eebb4266c7b66cab15095a1578cc6a62b1a/pathlib2-2.3.0-py2.py3-none-any.whl
Collecting pygments (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/02/ee/b6e02dc6529e82b75bb06823ff7d005b141037cb1416b10c6f00fc419dca/Pygments-2.2.0-py2.py3-none-any.whl (841kB)
    100% |████████████████████████████████| 849kB 1.7MB/s
Collecting traitlets>=4.2 (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/93/d6/abcb22de61d78e2fc3959c964628a5771e47e7cc60d53e9342e21ed6cc9a/traitlets-4.3.2-py2.py3-none-any.whl (74kB)
    100% |████████████████████████████████| 81kB 2.5MB/s
Collecting prompt-toolkit<2.0.0,>=1.0.3 (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/4b/85/58829b76140b81b30d2d455040808665b2041b923134a287643b684de4e3/prompt_toolkit-1.0.14-py2-none-any.whl (248kB)
    100% |████████████████████████████████| 256kB 688kB/s
Collecting appnope; sys_platform == "darwin" (from ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/87/a9/7985e6a53402f294c8f0e8eff3151a83f1fb901fa92909bb3ff29b4d22af/appnope-0.1.0-py2.py3-none-any.whl
Collecting ptyprocess>=0.5 (from pexpect; sys_platform != "win32"->ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/40/a5/184b46a3c986000196abd077166b2536acb2500009bec95feb9b8fc19828/ptyprocess-0.5.1-py2.py3-none-any.whl
Collecting scandir; python_version < "3.5" (from pathlib2; python_version == "2.7" or python_version == "3.3"->ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/bd/f4/3143e0289faf0883228017dbc6387a66d0b468df646645e29e1eb89ea10e/scandir-1.5.tar.gz
Collecting six (from pathlib2; python_version == "2.7" or python_version == "3.3"->ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/c8/0a/b6723e1bc4c516cb687841499455a8505b44607ab535be01091c0f24f079/six-1.10.0-py2.py3-none-any.whl
Collecting ipython-genutils (from traitlets>=4.2->ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl
Collecting enum34; python_version == "2.7" (from traitlets>=4.2->ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/c5/db/e56e6b4bbac7c4a06de1c50de6fe1ef3810018ae11732a50f15f62c7d050/enum34-1.1.6-py2-none-any.whl
Collecting wcwidth (from prompt-toolkit<2.0.0,>=1.0.3->ipython==5)
  Downloading http://mirrors.aliyun.com/pypi/packages/7e/9f/526a6947247599b084ee5232e4f9190a38f398d7300d866af3ab571a5bfe/wcwidth-0.1.7-py2.py3-none-any.whl
Building wheels for collected packages: scandir
  Running setup.py bdist_wheel for scandir ... done
  Stored in directory: /Users/lvmingzhi/Library/Caches/pip/wheels/50/3b/8e/e83592a28d1526e59fcba9d7295fcca421cceeaf2402e6368b
Successfully built scandir
Installing collected packages: scandir, six, pathlib2, pickleshare, simplegeneric, decorator, ptyprocess, pexpect, pygments, ipython-genutils, enum34, traitlets, wcwidth, prompt-toolkit, appnope, ipython
Successfully installed appnope-0.1.0 decorator-4.0.11 enum34-1.1.6 ipython-5.0.0 ipython-genutils-0.2.0 pathlib2-2.3.0 pexpect-4.2.1 pickleshare-0.7.4 prompt-toolkit-1.0.14 ptyprocess-0.5.1 pygments-2.2.0 scandir-1.5 simplegeneric-0.8.1 six-1.10.0 traitlets-4.3.2 wcwidth-0.1.7


(py2) lvmingzhideMacBook-Pro:~ lvmingzhi$ python -m ipykernel install --user
/Users/lvmingzhi/anaconda/envs/py2/bin/python: No module named ipykernel

(py2) lvmingzhideMacBook-Pro:~ lvmingzhi$ python -m pip install ipykernel==4.5
Collecting ipykernel==4.5
  Downloading http://mirrors.aliyun.com/pypi/packages/ab/3b/3ff53396b59d27173147ccb03579ed960e9cc3a95ffe72997131239894fb/ipykernel-4.5.0-py2.py3-none-any.whl (97kB)
    100% |████████████████████████████████| 102kB 918kB/s
Collecting tornado>=4.0 (from ipykernel==4.5)
  Downloading http://mirrors.aliyun.com/pypi/packages/df/42/a180ee540e12e2ec1007ac82a42b09dd92e5461e09c98bf465e98646d187/tornado-4.5.1.tar.gz (483kB)
    100% |████████████████████████████████| 491kB 982kB/s
Collecting jupyter-client (from ipykernel==4.5)
  Downloading http://mirrors.aliyun.com/pypi/packages/ab/f5/57a8d68eef68a7bec68a75cd1ef6e9d455c66106c65bf3ba37cb626ecebb/jupyter_client-5.0.1-py2.py3-none-any.whl (83kB)
    100% |████████████████████████████████| 92kB 855kB/s
Requirement already satisfied: ipython>=4.0.0 in ./anaconda/envs/py2/lib/python2.7/site-packages (from ipykernel==4.5)
Requirement already satisfied: traitlets>=4.1.0 in ./anaconda/envs/py2/lib/python2.7/site-packages (from ipykernel==4.5)
Collecting singledispatch (from tornado>=4.0->ipykernel==4.5)
  Downloading http://mirrors.aliyun.com/pypi/packages/c5/10/369f50bcd4621b263927b0a1519987a04383d4a98fb10438042ad410cf88/singledispatch-3.4.0.3-py2.py3-none-any.whl
Collecting certifi (from tornado>=4.0->ipykernel==4.5)
  Downloading http://mirrors.aliyun.com/pypi/packages/eb/01/c1f58987b777d6c4ec535b4e004a4a07bfc9db06f0c7533367ca6da8f2a6/certifi-2017.4.17-py2.py3-none-any.whl (375kB)
    100% |████████████████████████████████| 378kB 948kB/s
Collecting backports_abc>=0.4 (from tornado>=4.0->ipykernel==4.5)
  Downloading http://mirrors.aliyun.com/pypi/packages/7d/56/6f3ac1b816d0cd8994e83d0c4e55bc64567532f7dc543378bd87f81cebc7/backports_abc-0.5-py2.py3-none-any.whl
Collecting jupyter-core (from jupyter-client->ipykernel==4.5)
  Downloading http://mirrors.aliyun.com/pypi/packages/48/41/e64f3f38fdb4f7c98814ce93be8b9261068bf0d2ec3550a5ffb492316196/jupyter_core-4.3.0-py2.py3-none-any.whl (76kB)
    100% |████████████████████████████████| 81kB 2.2MB/s
Collecting python-dateutil>=2.1 (from jupyter-client->ipykernel==4.5)
  Downloading http://mirrors.aliyun.com/pypi/packages/40/8b/275015d7a9ec293cf1bbf55433258fbc9d0711890a7f6dc538bac7b86bce/python_dateutil-2.6.0-py2.py3-none-any.whl (194kB)
    100% |████████████████████████████████| 194kB 727kB/s
Collecting pyzmq>=13 (from jupyter-client->ipykernel==4.5)
  Downloading http://mirrors.aliyun.com/pypi/packages/ae/4e/cee5cf4fadc6d7a2da604c2e3b8fb5bef87756e2e2dd98acb9eb4bedf335/pyzmq-16.0.2-cp27-cp27m-macosx_10_6_intel.whl (1.1MB)
    100% |████████████████████████████████| 1.1MB 957kB/s
Requirement already satisfied: setuptools>=18.5 in ./anaconda/envs/py2/lib/python2.7/site-packages (from ipython>=4.0.0->ipykernel==4.5)
Requirement already satisfied: backports.shutil-get-terminal-size; python_version == "2.7" in ./anaconda/envs/py2/lib/python2.7/site-packages (from ipython>=4.0.0->ipykernel==4.5)
Requirement already satisfied: pickleshare in ./anaconda/envs/py2/lib/python2.7/site-packages (from ipython>=4.0.0->ipykernel==4.5)
Requirement already satisfied: simplegeneric>0.8 in ./anaconda/envs/py2/lib/python2.7/site-packages (from ipython>=4.0.0->ipykernel==4.5)
Requirement already satisfied: decorator in ./anaconda/envs/py2/lib/python2.7/site-packages (from ipython>=4.0.0->ipykernel==4.5)
Requirement already satisfied: pexpect; sys_platform != "win32" in ./anaconda/envs/py2/lib/python2.7/site-packages (from ipython>=4.0.0->ipykernel==4.5)
Requirement already satisfied: pathlib2; python_version == "2.7" or python_version == "3.3" in ./anaconda/envs/py2/lib/python2.7/site-packages (from ipython>=4.0.0->ipykernel==4.5)
Requirement already satisfied: pygments in ./anaconda/envs/py2/lib/python2.7/site-packages (from ipython>=4.0.0->ipykernel==4.5)
Requirement already satisfied: prompt-toolkit<2.0.0,>=1.0.3 in ./anaconda/envs/py2/lib/python2.7/site-packages (from ipython>=4.0.0->ipykernel==4.5)
Requirement already satisfied: appnope; sys_platform == "darwin" in ./anaconda/envs/py2/lib/python2.7/site-packages (from ipython>=4.0.0->ipykernel==4.5)
Requirement already satisfied: ipython-genutils in ./anaconda/envs/py2/lib/python2.7/site-packages (from traitlets>=4.1.0->ipykernel==4.5)
Requirement already satisfied: enum34; python_version == "2.7" in ./anaconda/envs/py2/lib/python2.7/site-packages (from traitlets>=4.1.0->ipykernel==4.5)
Requirement already satisfied: six in ./anaconda/envs/py2/lib/python2.7/site-packages (from traitlets>=4.1.0->ipykernel==4.5)
Requirement already satisfied: ptyprocess>=0.5 in ./anaconda/envs/py2/lib/python2.7/site-packages (from pexpect; sys_platform != "win32"->ipython>=4.0.0->ipykernel==4.5)
Requirement already satisfied: scandir; python_version < "3.5" in ./anaconda/envs/py2/lib/python2.7/site-packages (from pathlib2; python_version == "2.7" or python_version == "3.3"->ipython>=4.0.0->ipykernel==4.5)
Requirement already satisfied: wcwidth in ./anaconda/envs/py2/lib/python2.7/site-packages (from prompt-toolkit<2.0.0,>=1.0.3->ipython>=4.0.0->ipykernel==4.5)
Building wheels for collected packages: tornado
  Running setup.py bdist_wheel for tornado ... done
  Stored in directory: /Users/lvmingzhi/Library/Caches/pip/wheels/06/ed/55/cb6871fb05664853a8bbf46f18e4272ce5f17d3f8af0de4c4c
Successfully built tornado
Installing collected packages: singledispatch, certifi, backports-abc, tornado, jupyter-core, python-dateutil, pyzmq, jupyter-client, ipykernel
Successfully installed backports-abc-0.5 certifi-2017.4.17 ipykernel-4.5.0 jupyter-client-5.0.1 jupyter-core-4.3.0 python-dateutil-2.6.0 pyzmq-16.0.2 singledispatch-3.4.0.3 tornado-4.5.1


(py2) lvmingzhideMacBook-Pro:~ lvmingzhi$ python -m ipykernel install --user
Installed kernelspec python2 in /Users/lvmingzhi/Library/Jupyter/kernels/python2


(py2) lvmingzhideMacBook-Pro:~ lvmingzhi$ source deactivate py2
lvmingzhideMacBook-Pro:~ lvmingzhi$ jupyter notebook


[W 11:38:49.051 NotebookApp] All authentication is disabled.  Anyone who can connect to this server will be able to run code.
[I 11:38:49.052 NotebookApp] The port 8888 is already in use, trying another port.
[I 11:38:49.086 NotebookApp] [jupyter_nbextensions_configurator] enabled 0.2.5
[I 11:38:49.094 NotebookApp] Serving notebooks from local directory: /Users/lvmingzhi
[I 11:38:49.094 NotebookApp] 0 active kernels
[I 11:38:49.095 NotebookApp] The Jupyter Notebook is running at: http://localhost:8889/
[I 11:38:49.095 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 11:38:54.051 NotebookApp] Creating new notebook in
[I 11:38:54.725 NotebookApp] Kernel started: 9876f644-d387-4026-8292-79d142254ec8
[W 11:38:54.861 NotebookApp] 403 GET /nbextensions//Users/lvmingzhi/anaconda/lib/python3.6/site-packages/jupyter_contrib_nbextensions/nbextensions/codefolding/main.js?v=20170618113848 (::1): /Users/lvmingzhi/anaconda/lib/python3.6/site-packages/jupyter_contrib_nbextensions/nbextensions/codefolding/main.js is not in root static directory
[W 11:38:54.874 NotebookApp] 403 GET /nbextensions//Users/lvmingzhi/anaconda/lib/python3.6/site-packages/jupyter_contrib_nbextensions/nbextensions/codefolding/main.js?v=20170618113848 (::1) 13.76ms referer=http://localhost:8889/notebooks/Untitled.ipynb?kernel_name=python2
[W 11:38:54.882 NotebookApp] 404 GET /nbextensions//Users/lmingzhi/anaconda/lib/python3.6/site-packages/jupyter_contrib_nbextensions/nbextensions/codefolding/main.js?v=20170618113848 (::1) 6.89ms referer=http://localhost:8889/notebooks/Untitled.ipynb?kernel_name=python2
[W 11:38:54.884 NotebookApp] 404 GET /nbextensions//Users/lvmingzhi/anaconda/lib/python3.6/site-packages/.js?v=20170618113848 (::1) 1.46ms referer=http://localhost:8889/notebooks/Untitled.ipynb?kernel_name=python2
[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.version
[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.version
[I 11:40:54.785 NotebookApp] Saving file at /Untitled.ipynb

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,793评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,567评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,342评论 0 338
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,825评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,814评论 5 368
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,680评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,033评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,687评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 42,175评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,668评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,775评论 1 332
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,419评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,020评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,978评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,206评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,092评论 2 351
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,510评论 2 343

推荐阅读更多精彩内容