Reputation: 4884
I have this directory structure:
code/
├── some_script.py
├── Pipfile
├── Pipfile.lock
└── subdirectory/
└── script_to_run.py
Inside subdirectory/
directory, I want to run script_to_run.py
, however when I pipenv run python3 script_to_run.py
I get the problem that pipenv assumes I'm in the code/
directory, rather than the subdirectory/
directory.
How do I generate a new virtualenv for subdirectory/
with pipenv?
Upvotes: 3
Views: 3940
Reputation: 197
For newbies like me:
Create an empty file (fill with 1 space if using nano) named "Pipfile" (must with capital "P").
Then just run "pipenv shell" in the subfolder. It should create a new env in the subfolder.
Upvotes: 1
Reputation: 4884
cd subdirectory
touch Pipfile
pipenv run python3 script_to_run.py
This will generate a new virtualenv for this subdirectory.
Upvotes: 5