如何使用 pipenv 到当前文件夹中的 运行 文件
how to use pipenv to run file in current folder
使用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
您可以激活虚拟环境然后运行文件
pipenv shell
python train.py
使用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
您可以激活虚拟环境然后运行文件
pipenv shell
python train.py