weixin_39588679
2021-01-10 06:37 阅读 10

Creating venv (python -m venv venv) causes error on Windows

Current Behavior

Creating a venv in Powershell on Windows 10 causes error:


> python -m venv venv
Error: [Errno 2] No such file or directory: 'C:\\Users\\fredrik\\Miniconda3\\lib\\venv\\scripts\\nt\\python.exe'

Steps to Reproduce

  1. Install https://repo.anaconda.com/miniconda/Miniconda3-4.6.14-Windows-x86_64.exe on Windows 10 without any kind of Python installed previously.
  2. During install, choose...
  3. "Just me"
  4. tick "Add conda to my PATH..."
  5. untick the "Register Anaconda as my default Python 3.7"
  6. Run python -m venv venv in a Powershell prompt

Expected Behavior

Well, a venv called venv should've been created without errors.

Environment Information

Windows 10, May 2019 update

`conda info`


     active environment : None
       user config file : C:\Users\fredrik\.condarc
 populated config files : C:\Users\fredrik\.condarc
          conda version : 4.6.14
    conda-build version : not installed
         python version : 3.7.3.final.0
       base environment : C:\Users\fredrik\Miniconda3  (writable)
           channel URLs : https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/win-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\fredrik\Miniconda3\pkgs
                          C:\Users\fredrik\.conda\pkgs
                          C:\Users\fredrik\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\fredrik\Miniconda3\envs
                          C:\Users\fredrik\.conda\envs
                          C:\Users\fredrik\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.6.14 requests/2.21.0 CPython/3.7.3 Windows/10 Windows/10.0.18362
          administrator : False
             netrc file : None
           offline mode : False
`conda config --show-sources`


==> C:\Users\iruser\.condarc <==
channels:
  - conda-forge
  - defaults
`conda list --show-channel-urls`


# packages in environment at C:\Users\iruser\Miniconda3:
#
# Name                    Version                   Build  Channel
asn1crypto                0.24.0                   py37_0    defaults
ca-certificates           2019.1.23                     0    defaults
certifi                   2019.3.9                 py37_0    defaults
cffi                      1.12.2           py37h7a1dbc1_1    defaults
chardet                   3.0.4                    py37_1    defaults
conda                     4.6.14                   py37_0    defaults
console_shortcut          0.1.1                         3    defaults
cryptography              2.6.1            py37h7a1dbc1_0    defaults
idna                      2.8                      py37_0    defaults
menuinst                  1.4.16           py37he774522_0    defaults
openssl                   1.1.1b               he774522_1    defaults
pip                       19.0.3                   py37_0    defaults
powershell_shortcut       0.0.1                         2    defaults
pycosat                   0.6.3            py37hfa6e2cd_0    defaults
pycparser                 2.19                     py37_0    defaults
pyopenssl                 19.0.0                   py37_0    defaults
pysocks                   1.6.8                    py37_0    defaults
python                    3.7.3                h8c8aaf0_0    defaults
pywin32                   223              py37hfa6e2cd_1    defaults
requests                  2.21.0                   py37_0    defaults
ruamel_yaml               0.15.46          py37hfa6e2cd_0    defaults
setuptools                41.0.0                   py37_0    defaults
six                       1.12.0                   py37_0    defaults
sqlite                    3.27.2               he774522_0    defaults
urllib3                   1.24.1                   py37_0    defaults
vc                        14.1                 h0510ff6_4    defaults
vs2015_runtime            14.15.26706          h3a45250_0    defaults
wheel                     0.33.1                   py37_0    defaults
win_inet_pton             1.1.0                    py37_0    defaults
wincertstore              0.2                      py37_0    defaults
yaml                      0.1.7                hc54c509_2    defaults

该提问来源于开源项目:conda/conda

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

5条回答 默认 最新

  • weixin_39819576 weixin_39819576 2021-01-10 06:37

    Issuing conda update python will fix this.

    点赞 评论 复制链接分享
  • weixin_39819576 weixin_39819576 2021-01-10 06:37

    But please use conda envs instead if you can, they are far better.

    点赞 评论 复制链接分享
  • weixin_39588679 weixin_39588679 2021-01-10 06:37

    Your suggestion does not work for me.

    
    > conda update python
    Collecting package metadata: done
    Solving environment: done
    
    ## Package Plan ##
    
      environment location: C:\Users\fredrik\Miniconda3
    
      added / updated specs:
        - python
    
    
    The following packages will be downloaded:
    
        package                    |            build
        ---------------------------|-----------------
        ca-certificates-2019.3.9   |       hecc5488_0         184 KB  conda-forge
        certifi-2019.3.9           |           py37_0         149 KB  conda-forge
        conda-4.6.14               |           py37_0         2.1 MB  conda-forge
        openssl-1.1.1b             |       hfa6e2cd_2         4.8 MB  conda-forge
        python-3.7.3               |       hb12ca83_0        17.8 MB  conda-forge
        ------------------------------------------------------------
                                               Total:        25.0 MB
    
    The following packages will be UPDATED:
    
      ca-certificates    pkgs/main::ca-certificates-2019.1.23-0 --> conda-forge::ca-certificates-2019.3.9-hecc5488_0
      openssl              pkgs/main::openssl-1.1.1b-he774522_1 --> conda-forge::openssl-1.1.1b-hfa6e2cd_2
    
    The following packages will be SUPERSEDED by a higher-priority channel:
    
      certifi                                         pkgs/main --> conda-forge
      conda                                           pkgs/main --> conda-forge
      python                 pkgs/main::python-3.7.3-h8c8aaf0_0 --> conda-forge::python-3.7.3-hb12ca83_0
    
    
    Proceed ([y]/n)? y
    
    
    Downloading and Extracting Packages
    ca-certificates-2019 | 184 KB    | ############################################################################ | 100%
    python-3.7.3         | 17.8 MB   | ############################################################################ | 100%
    openssl-1.1.1b       | 4.8 MB    | ############################################################################ | 100%
    certifi-2019.3.9     | 149 KB    | ############################################################################ | 100%
    conda-4.6.14         | 2.1 MB    | ############################################################################ | 100%
    Preparing transaction: done
    Verifying transaction: done
    Executing transaction: done
    
    
    > python -m venv venv
    Error: [Errno 2] No such file or directory: 'C:\\Users\\fredrik\\Miniconda3\\lib\\venv\\scripts\\nt\\python.exe'
    
    
    点赞 评论 复制链接分享
  • weixin_39819576 weixin_39819576 2021-01-10 06:37

    Ah, sorry, conda-forge do not yet have my bug fix yet. If you use Python from defaults you should be ok:

    conda install defaults::python

    点赞 评论 复制链接分享
  • weixin_39588679 weixin_39588679 2021-01-10 06:37

    Thank you - that worked better! 👍

    点赞 评论 复制链接分享

相关推荐