gpt4 book ai didi

python - 如何使用pipenv运行当前文件夹中的文件

转载 作者:行者123 更新时间:2023-12-04 01:21:05 24 4
gpt4 key购买 nike

使用 pipenv在文件夹中创建虚拟环境。
但是,环境似乎在路径中:

/Users/....../.local/share/virtualenvs/......



当我运行命令时 pipenv run python train.py ,我得到错误:

can't open file 'train.py': [Errno 2] No such file or directory



如何在我创建虚拟环境的文件夹中运行文件?

最佳答案

您需要位于要运行的文件的同一目录中,然后使用:pipenv run python train.py笔记:

You may be at the project main directory while the file you need to run is inside a directory inside your project directory

If you use django to create your project, it will create two folders inside each other with the same name so as a best practice change the top directory name to 'yourname-project' then inside the directory 'yourname' run the pipenv run python train.py command

关于python - 如何使用pipenv运行当前文件夹中的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53322703/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com