我最近正在清理我的电脑。我删除了vstudio2017。
现在我的环境
python3.6,win10
奇怪的事情发生了,pipenv似乎完全无效。
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'
我删除了python3.6和pipenv以及reload python3.7和pipenv。但他们有同样的问题。
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'
我列出了我试过的内容。
这是一个看起来很像me.Python sees json
module but pipenv doesn't. Why?的例子
我猜他可能已经解决了这个问题,但我没有足够的声誉来评论。如果有人能给我一些建议,我将不胜感激。
感谢bryan,bryan提醒我,当我选择一个新文件夹并运行pipenv shell时
[ ] Creating virtual environment...Already using interpreter c:\users\hank\appdata\local\programs\python\python36\python.exe
Using base prefix 'c:\\users\\hank\\appdata\\local\\programs\\python\\python36'
New python executable in C:\Users\hank\.virtualenvs\hankspace-spEtL83E\Scripts\python.exe
Command C:\Users\hank\.virtua...E\Scripts\python.exe -m pip config list had error code 1
Installing setuptools, pip, wheel...
Complete output from command C:\Users\hank\.virtua...E\Scripts\python.exe - setuptools pip wheel:
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
ModuleNotFoundError: No module named 'pkgutil'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Failed creating virtual environment
[pipenv.exceptions.VirtualenvCreationException]: File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\pipenv\cli\command.py", line 390, in shell
[pipenv.exceptions.VirtualenvCreationException]: pypi_mirror=state.pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\pipenv\core.py", line 2156, in do_shell
[pipenv.exceptions.VirtualenvCreationException]: three=three, python=python, validate=False, pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\pipenv\core.py", line 574, in ensure_project
[pipenv.exceptions.VirtualenvCreationException]: pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\pipenv\core.py", line 506, in ensure_virtualenv
[pipenv.exceptions.VirtualenvCreationException]: python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
[pipenv.exceptions.VirtualenvCreationException]: File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\pipenv\core.py", line 935, in do_create_virtualenv
[pipenv.exceptions.VirtualenvCreationException]: extra=[crayons.blue("{0}".format(c.err)),]
[pipenv.exceptions.VirtualenvCreationException]: Traceback (most recent call last):
File "c:\users\hank\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\hank\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 2567, in <module>
main()
File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 793, in main
symlink=options.symlink,
File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 1088, in create_environment
install_wheel(to_install, py_executable, search_dirs, download=download)
File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 935, in install_wheel
_install_wheel_with_search_dir(download, project_names, py_executable, search_dirs)
File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 1025, in _install_wheel_with_search_dir
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=script)
File "c:\users\hank\appdata\local\programs\python\python36\lib\site-packages\virtualenv.py", line 886, in call_subprocess
raise OSError("Command {} failed with error code {}".format(cmd_desc, proc.returncode))
OSError: Command C:\Users\hank\.virtua...E\Scripts\python.exe - setuptools pip wheel failed with error code 1
Failed to create virtual environment.
然后我发现这个问题可以追溯到virtualenv,最后我发现这篇文章https://itqna.net/questions/16455/problems-trying-create-virtual-environment-pipenv解决了我的问题
python -m venv .venv
pipenv shell
pipenv install
有效!
基于您共享的命令和回溯,您实际创建并输入了您的环境吗? (pipenv shell)
我遇到了一个类似的问题,它在安装软件包后无法锁定,结果发现我安装了64位和32位Python,这引起了冲突。为了解决这个问题,我删除了32位(开始菜单 - >设置 - >应用程序),然后删除了我已经创建的虚拟环境。导航到C:\ Users \ .virtualenvs,然后删除具有您的环境名称的文件夹。现在,您可以通过调用pipenv shell导航回您的文件夹并再次创建pipenv环境。
请尝试以下命令:
python36ana.exe -m pipenv --python 3.6