【问题标题】:Error with virtual env on python (MAC)python(MAC)上的虚拟环境错误
【发布时间】:2016-12-30 20:55:14
【问题描述】:

我在 MAC 上使用 virtualenv 时遇到问题...这就是我要做的:

Tester-MacBook-Pro:myproject tester$ virtualenv foobar
New python executable in /Users/tester/Documents/myproject/foobar/bin/python
Installing setuptools, pip, wheel...
  Complete output from command /Users/tester/...ct/foobar/bin/python - setuptools pip wheel:
  Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
  File "/Users/tester/anaconda/lib/python2.7/tempfile.py", line 32, in <module>
    import io as _io
  File "/Users/tester/anaconda/lib/python2.7/io.py", line 51, in <module>
    import _io
ImportError: dlopen(/Users/tester/Documents/myproject/foobar/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
  Referenced from: /Users/tester/Documents/myproject/foobar/lib/python2.7/lib-dynload/_io.so
  Expected in: flat namespace
 in /Users/tester/Documents/myproject/foobar/lib/python2.7/lib-dynload/_io.so
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/Users/tester/anaconda/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/Users/tester/anaconda/lib/python2.7/site-packages/virtualenv.py", line 713, in main
    symlink=options.symlink)
  File "/Users/tester/anaconda/lib/python2.7/site-packages/virtualenv.py", line 945, in create_environment
    download=download,
  File "/Users/tester/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/tester/anaconda/lib/python2.7/site-packages/virtualenv.py", line 797, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/tester/...ct/foobar/bin/python - setuptools pip wheel failed with error code 1

【问题讨论】:

  • 根本原因是ImportError: dlopen(/Users/tester/Documents/myproject/foobar/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder。祝你好运。你被2.7卡住了吗?或者您可以尝试更新的版本,例如 3.5?

标签: python macos python-2.7


【解决方案1】:

我也遇到了同样的问题。

原来我使用的是 python-2.7.13,降级到 2.7.10 解决了这个问题。

如果您使用 Anaconda,可以通过运行:
$ conda install python=2.7.10

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-01-05
    • 1970-01-01
    • 1970-01-01
    • 2017-12-04
    • 1970-01-01
    • 1970-01-01
    • 2019-03-21
    • 2021-06-01
    相关资源
    最近更新 更多