简体   繁体   English

无法在 Windows 上的 conda Python 3.8.3 环境中使用 pipenv 创建虚拟环境

[英]Failed to create a virtual environment using pipenv inside a conda Python 3.8.3 environment on Windows

System and environment details:系统和环境详情:
Anaconda based python environment on a Windows 10 PC Windows 10 PC 上基于 Anaconda 的 Python 环境
conda 4.8.5康达 4.8.5
Python 3.8.3蟒蛇 3.8.3
pipenv version 2020.8.13 pipenv 版本 2020.8.13

I wish to launch a virtual environment for a new project, install the dependencies inside that virtual environment and run the code.我希望为新项目启动一个虚拟环境,在该虚拟环境中安装依赖项并运行代码。 The project is located in the code/ directory on my PC.该项目位于我 PC 上的 code/ 目录中。 I installed pipenv in my PC for creating a virtual environment using pip install pipenv .我在我的 PC 中安装了 pipenv 以使用pip install pipenv创建虚拟环境。 To create a virtual environment using pipenv, I executed the command pipenv shell from the root of my project directory (code) and got the following output.为了使用 pipenv 创建虚拟环境,我从我的项目目录(代码)的根目录执行命令pipenv shell并得到以下输出。

$ pipenv shell
Creating a virtualenv for this project...
Pipfile: C:\Users\myPC\code\Pipfile
Using C:/Users/myPC/Anaconda3/python.exe (3.8.3) to create virtualenv...
[==  ] Creating virtual environment...FileNotFoundError: [Errno 2] No such file or directory: 'c:\\users\\myPC\\anaconda3\\Lib\\venv\\scripts\\nt\\python.exe'

Failed creating virtual environment

[pipenv.exceptions.VirtualenvCreationException]:
Failed to create virtual environment.

The python executable being pointed to in the output above ie, C:/Users/myPC/Anaconda3/python.exe (3.8.3) is the place where Anaconda is installed in my PC, so this seems to be fine.上面输出中指向的 python 可执行文件,即 C:/Users/myPC/Anaconda3/python.exe (3.8.3) 是 Anaconda 在我的 PC 中安装的地方,所以这似乎没问题。 However, I do not understand what file it is looking for in the last line of the output.但是,我不明白它在输出的最后一行中寻找什么文件。

I was able to solve this issue myself by referring the solution mentioned in this github issue .通过参考这个github issue 中提到的解决方案,我能够自己解决这个问题 Although, this seems to be a workaround for the moment but nevertheless, it works.虽然,这似乎是目前的一种解决方法,但尽管如此,它仍然有效。

I manually copied the python.exe and pythonw.exe from C:/Users/myPC/Anaconda3/ directory into c:\\users\\myPC\\anaconda3\\Lib\\venv\\scripts\\nt\\我手动将 python.exe 和 pythonw.exe 从 C:/Users/myPC/Anaconda3/ 目录复制到 c:\\users\\myPC\\anaconda3\\Lib\\venv\\scripts\\nt\\

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM