Using pipenv to create a virtual environment in a folder.
However, the environment seems to be in the path:
/Users/....../.local/share/virtualenvs/......
And when I run the command pipenv run python train.py, I get the error:
can't open file 'train.py': [Errno 2] No such file or directory
How to run a file in the folder where I created the virtual environment?
2 Answers 2
You need to be in the same directory of the file you want to run then use:
pipenv run python train.py
Note:
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.pycommand
Comments
You can activate the virtual environment then run the file
pipenv shell
python train.py
Comments
Explore related questions
See similar questions with these tags.
pipenv --where