我想使用pipenv创建虚拟环境。
为了创建虚拟环境,我使用了pipenv。但是,即使我尝试在一个空目录上创建虚拟环境,也会出现错误。
> cd C:\Users\namae\OneDrive\Document
> mkdir test
> cd test
> py -m pipenv install
请注意,我没有传递python的路径(因为在安装它时建议使用...),这就是为什么我使用py -m
。
错误消息如下:
Creating a virtualenv for this project…
Pipfile: C:\Users\namae\OneDrive\Document\Pipfile
Using C:/Users/namae/AppData/Local/Programs/Python/Python38/python.exe (3.8.4) to create virtualenv…
[ ===] Creating virtual environment...created virtual environment CPython3.8.4.final.0-64 in 1729ms
creator CPython3Windows(dest=C:\Users\namae\.virtualenvs\Document-93FUvPFU, clear=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\namae\AppData\Local\pypa\virtualenv)
added seed packages: pip==20.2.2, setuptools==49.6.0, wheel==0.35.1
activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
Successfully created virtual environment!
Virtualenv location: C:\Users\namae\.virtualenvs\Document-93FUvPFU
Creating a Pipfile for this project…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (1f10f9)!
Traceback (most recent call last):
File "c:\users\namae\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
...(omittion for viewing)
line 662, in lockfile_content
return self.load_lockfile()
File "c:\users\namae\appdata\local\programs\python\python38\lib\site-packages\pipenv\project.py", line 1054, in load_lockfile
j["_meta"]["sources"][i]["url"]
KeyError: 'url'
在目录C:\ Users \ namae \ OneDrive \ Document \ test中,创建了两个文件-“ pipfile”和“ pipfile.lock”。
pipfile
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
[requires]
python_version = "3.8"
pipfile.lock
{
"_meta": {
"hash": {
"sha256": "c2384ad47b0fded84aa8d567ff10e9e32bb6e8da4cb9d05c0b5403e63a1f10f9"
},
"pipfile-spec": 6,
"requires": {},
"sources": [
{}
]
},
"default": {},
"develop": {}
}
Windows10主页