I am cleaning my computer recently.I deleted vstudio2017.
Now my environment
python3.6,win10
Strange things have happened,pipenv seems to be completely invalid.
PS F:\hankspace\flaskproject> pipenv install
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Locking Failed!
Traceback (most recent call last):
File "c:/users/hank/appdata/local/programs/python/python37/lib/site-packages/pipenv/resolver.py", line 3, in <module>
import json
ModuleNotFoundError: No module named 'json'
File "c:/users/hank/appdata/local/programs/python/python37/lib/site-packages/pipenv/resolver.py", line 3, in <module>
import json
ModuleNotFoundError: No module named 'json'
I deleted python3.6 and pipenv in addition reload python3.7 and pipenv. but they have same problem.
PS F:\hankspace\flaskproject> pipenv graph
ERROR: Traceback (most recent call last):
File "c:\\users\\hank\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\pipenv\\vendor\\pipdeptree.py", line 6, in <module>
import argparse
ModuleNotFoundError: No module named 'argparse'
I listed what I filed tried.
Here is a example that looks a lot like me.Python sees json
module but pipenv doesn't. Why?
I guess he may have solved the problem but I’m no enought reputation to comment. I will be grateful if someone can give me some advice.
What fixed it for me was adding the following to my system environment variables:
In Windows:
setx /M PIPENV_VENV_IN_PROJECT 1
This will force pipenv to create a ".venv" directory in your project folder instead of the default "virtualenvs" in your user profile directory (this part is what is breaking "pipenv install"). It will also give you the proper ".venv" directory and file structure that corresponds to the way pipenv creates it instead of the way "python -m venv .venv" creates it. From what I've seen, the structures are different.
More information about this issue can be found at the following URL: https://github.com/pypa/pipenv/issues/1382
If you want this same result in Linux, set the variable with the following command:
export PIPENV_VENV_IN_PROJECT=1