Mac virtualenv新しい環境エラーの作成

2313 ワード

前言:Mac、virtualenvはインストールされていますが、砂箱環境を作成する際にエラーが発生しました.エラーメッセージは以下の通りです.
Arons-MacBook-Pro:virtualenv_tensorflow aron$ virtualenv venv_tensorflow
New python executable in /Users/aron/Documents/work_python/virtualenv_tensorflow/venv_tensorflow/bin/python
Installing setuptools, pip, wheel...
  Complete output from command /Users/aron/Document...ensorflow/bin/python - setuptools pip wheel:
  Traceback (most recent call last):
  File "", line 4, in 
  File "/Users/aron/anaconda/lib/python2.7/tempfile.py", line 32, in 
    import io as _io
  File "/Users/aron/anaconda/lib/python2.7/io.py", line 51, in 
    import _io
ImportError: dlopen(/Users/aron/Documents/work_python/virtualenv_tensorflow/venv_tensorflow/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
  Referenced from: /Users/aron/Documents/work_python/virtualenv_tensorflow/venv_tensorflow/lib/python2.7/lib-dynload/_io.so
  Expected in: flat namespace
 in /Users/aron/Documents/work_python/virtualenv_tensorflow/venv_tensorflow/lib/python2.7/lib-dynload/_io.so
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/Users/aron/anaconda/bin/virtualenv", line 11, in 
    sys.exit(main())
  File "/Users/aron/anaconda/lib/python2.7/site-packages/virtualenv.py", line 713, in main
    symlink=options.symlink)
  File "/Users/aron/anaconda/lib/python2.7/site-packages/virtualenv.py", line 945, in create_environment
    download=download,
  File "/Users/aron/anaconda/lib/python2.7/site-packages/virtualenv.py", line 901, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/Users/aron/anaconda/lib/python2.7/site-packages/virtualenv.py", line 797, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/aron/Document...ensorflow/bin/python - setuptools pip wheel failed with error code 1

解決方法:
(1)conda install python=2.7.9ダウングレードバージョンを先に実行
(2)virtualenv venvの再実行
OK、大成功!!
参照先:https://github.com/conda/conda/issues/1367
備考:本機のpython 2.7、anacondaがインストールされています(デフォルト)