2019年11月14日木曜日

pipenvでpythonのバージョンを指定した際にエラー。「$ pipenv --two」や「$ pyenv install 3.7.1」だと正常に終了。3.7はインストールエラーになりやすい様です。

https://kapiecii.hatenablog.com/entry/2019/01/24/110817
シェアしました。

kapieciiのブログ

日々学んだことを残しておくためのブログです。このブログはGoogle Analyticsを利用しています。

pipenvでpythonのバージョンを指定した際にエラー

pipenvでpythonのバージョンを指定した際にエラーが発生した。
同じエラーに直面した人の役に立つかもしれないのでメモしておく。
$ pipenv --python 3.6.5

{中略}

✘ Failed creating virtual environment 
[pipenv.exceptions.VirtualenvCreationException]:   File "/Users/{User}/.pyenv/versions/2.7.13/lib/python2.7/site-packages/pipenv/cli/command.py", line 208, in cli
[pipenv.exceptions.VirtualenvCreationException]:       clear=state.clear,
[pipenv.exceptions.VirtualenvCreationException]:   File "/Users/{User}/.pyenv/versions/2.7.13/lib/python2.7/site-packages/pipenv/core.py", line 574, in ensure_project
[pipenv.exceptions.VirtualenvCreationException]:       pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]:   File "/Users/{User}/.pyenv/versions/2.7.13/lib/python2.7/site-packages/pipenv/core.py", line 536, in ensure_virtualenv
[pipenv.exceptions.VirtualenvCreationException]:       pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]:   File "/Users/{User}/.pyenv/versions/2.7.13/lib/python2.7/site-packages/pipenv/core.py", line 506, in ensure_virtualenv
[pipenv.exceptions.VirtualenvCreationException]:       python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
[pipenv.exceptions.VirtualenvCreationException]:   File "/Users/{User}/.pyenv/versions/2.7.13/lib/python2.7/site-packages/pipenv/core.py", line 935, in do_create_virtualenv
[pipenv.exceptions.VirtualenvCreationException]:       extra=[crayons.blue("{0}".format(c.err)),]
[pipenv.exceptions.VirtualenvCreationException]: Traceback (most recent call last):
  File "/Users/{User}/.pyenv/versions/2.7.13/lib/python2.7/site-packages/virtualenv.py", line 2438, in <module>
    main()
  File "/Users/{User}/.pyenv/versions/2.7.13/lib/python2.7/site-packages/virtualenv.py", line 768, in main
    symlink=options.symlink,
  File "/Users/{User}/.pyenv/versions/2.7.13/lib/python2.7/site-packages/virtualenv.py", line 1013, in create_environment
    install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
  File "/Users/{User}/.pyenv/versions/2.7.13/lib/python2.7/site-packages/virtualenv.py", line 1236, in install_python
    copy_required_modules(home_dir, symlink)
  File "/Users/{User}/.pyenv/versions/2.7.13/lib/python2.7/site-packages/virtualenv.py", line 1163, in copy_required_modules
    dst_filename = change_prefix(filename, dst_prefix)
  File "/Users/{User}/.pyenv/versions/2.7.13/lib/python2.7/site-packages/virtualenv.py", line 1128, in change_prefix
    assert False, "Filename {} does not start with any of these prefixes: {}".format(filename, prefixes)
AssertionError: Filename /Users/{User}/.pyenv/versions/3.6.5/lib/python3.6/lib-dynload/zlib.cpython-36m-darwin.so does not start with any of these prefixes: ['/Users/{User}/.pyenv/versions/3.6.5/Python.framework/Versions/3.6/Extras/lib/python', '/Users/{User}/.pyenv/versions/3.6.5/Python.framework/Versions/3.6', '/Users/{User}/.pyenv/versions/3.6.5/Python.framework/Versions/3.6', '/Users/{User}/Library/Python/3.6/lib/python/site-packages', '/Users/{User}/.local/lib/python/3.6/site-packages', '/Users/{User}/Library/Python/3.6/site-packages', '/Library/Python/3.6/site-packages']

Failed to create virtual environment.
詳しく更新情報を追う時間はなかったが、「$ pipenv --two」や「$ pyenv install 3.7.1」だと正常に終了したので、3.6.5で起こる問題らしい?

0 コメント:

コメントを投稿