我正在尝试使用运行 Django 项目pipenv shell
。但是当我输入命令时pipenv shell
, 它失败。
❯ pipenv shell
Creating a virtualenv for this project…
Pipfile: /Users/juyeong/Desktop/django_workspace/Pipfile
Using /usr/local/bin/python3 (3.7.3) to create virtualenv…
⠸ Creating virtual environment...Already using interpreter /usr/local/bin/python3
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.7'
Running virtualenv with interpreter /usr/local/bin/python3
✘ Failed creating virtual environment
[pipenv.exceptions.VirtualenvCreationException]: File "/usr/local/lib/python3.7/site-packages/pipenv/cli/command.py", line 390, in shell
[pipenv.exceptions.VirtualenvCreationException]: pypi_mirror=state.pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 2156, in do_shell
[pipenv.exceptions.VirtualenvCreationException]: three=three, python=python, validate=False, pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "/usr/local/lib/python3.7/site-packages/pipenv/core.py", line 574, in ensure_project
[pipenv.exceptions.VirtualenvCreationException]: pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "/usr/local/lib/python3.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 "/usr/local/lib/python3.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 "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 417, in copyfile
os.symlink(os.path.realpath(src), dest)
FileExistsError: [Errno 17] File exists: '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin' -> '/Users/juyeong/.local/share/virtualenvs/django_workspace-CfQ2tbWB/lib/python3.7/config-3.7m-darwin'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 2611, in <module>
main()
File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 862, in main
symlink=options.symlink,
File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 1137, in create_environment
install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 1421, in install_python
copy_required_files(stdlib_dir, lib_dir, symlink)
File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 1331, in copy_required_files
copyfile(join(src_dir, fn), join(lib_dir, fn), symlink)
File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 420, in copyfile
copy_file_or_folder(src, dest, symlink)
File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 398, in copy_file_or_folder
shutil.copytree(src, dest, symlink)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/shutil.py", line 321, in copytree
os.makedirs(dst)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/os.py", line 221, in makedirs
mkdir(name, mode)
FileExistsError: [Errno 17] File exists: '/Users/juyeong/.local/share/virtualenvs/django_workspace-CfQ2tbWB/lib/python3.7/config-3.7m-darwin'
Failed to create virtual environment.
我用的时候一切正常pipenv shell
在 macOS 中Mojave
,现在我正在使用Catalina version 10.15.1
它根本不起作用。我尝试过升级 pip、删除并重新安装 pipelinev 但发生同样的事情。 :'(
谁能帮我解决这个问题?
附:我想使用虚拟环境pipenv shell
,不与python -m venv