【已解决】pipenv无法创建虚拟环境

笔者在使用pipenv期间,遇到无法创建虚拟环境的问题,经过多方尝试,终于发现解决办法。

[pipenv.exceptions.VirtualenvCreationException]: Traceback (most recent call last):
  File "c:\users\administrator\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\administrator\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 2634, in <module>
    main()
  File "c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 870, in main
    symlink=options.symlink,
  File "c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 1179, in create_environment
    install_wheel(to_install, py_executable, search_dirs, download=download)
  File "c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 1023, in install_wheel
    _install_wheel_with_search_dir(download, project_names, py_executable, search_dirs)
  File "c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 1116, in _install_wheel_with_search_dir
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=script)
  File "c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 963, in call_subprocess
    raise OSError("Command {} failed with error code {}".format(cmd_desc, proc.returncode))
OSError: Command C:\Users\Administrat...p\Scripts\python.exe - setuptools pip wheel failed with error code 1

Failed to create virtual environment.

 

解决方法如下:

pipenv 后边增加版本号即可。

pipenv --python 3.7

Microsoft Windows [Version 10.0.18362.720]
(c) 2019 Microsoft Corporation。保留所有权利。

E:\Scrapy\sdToday>pipenv --python 3.7
Creating a virtualenv for this project…
Pipfile: E:\Scrapy\sdToday\Pipfile
Using C:/Users/Administrator/AppData/Local/Programs/Python/Python37/python.exe (3.7.3) to create virtualenv…
[ ===] Creating virtual environment...Already using interpreter C:\Users\Administrator\AppData\Local\Programs\Python\Python37\python.exe
Using base prefix 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python37'
New python executable in C:\Users\Administrator\.virtualenvs\sdToday-bJTIKHmI\Scripts\python.exe
Installing setuptools, pip, wheel...
done.
Running virtualenv with interpreter C:/Users/Administrator/AppData/Local/Programs/Python/Python37/python.exe

Successfully created virtual environment!
Virtualenv location: C:\Users\Administrator\.virtualenvs\sdToday-bJTIKHmI
Creating a Pipfile for this project…

 

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值