运行virtualenv时出现FileNotFoundError

时间:2016-11-24 06:30:21

标签: python-3.x virtualenv

当我运行命令python -m virtualenv venv

我得到以下输出:

Traceback (most recent call last):
    File "runpy.py", line 184, in _run_module_as_main
    File "runpy.py", line 85, in _run_code
    File "C:\python\lib\site-packages\virtualenv.py", line 2328, in <module>main()
    File "C:\python\lib\site-packages\virtualenv.py", line 713, in main symlink=option.symlink)
    File "C:\python\lib\site-packages\virtualenv.py", line 925, in create_environment site_packages=site-packaged clear= clear, symlink=simlink
    File "C:\python\lib\site-packages\virtualenv.py", line 1147, in install_python writefile(site_filename_dst, SITE_PY)
    File "C:\python\lib\site-packages\virtualenv.py", line 362, in writefile with open(dest, 'wb') as F:
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\python\\sites\\venv\\python35.zip\\site.py'

当我导航到&#39; venv&#39;文件夹文件结构完全没有填充只有C:\ Python \ sites \ venv \ Lib \ site-packages(完全为空)

我尝试过重新安装virtualenv并无缘无故地搜索问题。请指教

1 个答案:

答案 0 :(得分:0)

您是否在计算机上正确安装了python?我之前也遇到过类似的问题。它是由我的python安装引起的。 你看看你是否检查了你的python路径并转到Lib文件夹,我认为没有site.py。你可以:

  • 重新安装你的python,确保它已正确安装(查看LibScript文件夹)
  • 更正您的用户/系统环境的python路径:我假设您正在使用Window OSX,例如:setx PYTHONHOME "C:\<your_python_path>";将其添加到您的路径:setx PATH "%PATH%;%PYTHONHOME%"
  • 如果您想在没有pip的情况下访问python -m
  • ,请不要忘记添加脚本路径

干杯!!