在装有 Python 3.9.5 和 pipenv 2021.5.29 的 Windows 10 机器上。在一个pipenv shell
:
Creating a virtualenv for this project...
Pipfile: C:\Users\jp\Documents\programming\imseg\Pipfile
Using C:/OSGeo4W/bin/python.exe (3.9.5) to create virtualenv...
[ ===] Creating virtual environment...created virtual environment CPython3.9.5.final.0-64 in 612ms
creator CPython3Windows(dest=C:\Users\jp\.virtualenvs\imseg-cT2t34Fc, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\jp\AppData\Local\pypa\virtualenv)
added seed packages: pip==21.2.2, setuptools==57.4.0, wheel==0.36.2
activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator
Successfully created virtual environment!
Virtualenv location: C:\Users\jp\.virtualenvs\imseg-cT2t34Fc
Launching subshell in virtual environment...
Microsoft Windows [Version 10.0.19043.1165]
(c) Microsoft Corporation. All rights reserved.
我用过pipenv install
。这将返回:
(imseg-cT2t34Fc) C:\Users\jp\Documents\programming\imseg>pipenv install
Installing dependencies from Pipfile.lock (684440)...
================================ 19/19 - 00:01:02
pipenv graph
:
(imseg-cT2t34Fc) C:\Users\jp\Documents\programming\imseg>pipenv graph
Cython==0.29.24
GitPython==3.1.18
- gitdb [required: >=4.0.1,<5, installed: 4.0.7]
- smmap [required: >=3.0.1,<5, installed: 4.0.0]
matplotlib==3.4.2
- cycler [required: >=0.10, installed: 0.10.0]
- six [required: Any, installed: 1.16.0]
- kiwisolver [required: >=1.0.1, installed: 1.3.1]
- numpy [required: >=1.16, installed: 1.21.1]
- pillow [required: >=6.2.0, installed: 8.3.1]
- pyparsing [required: >=2.2.1, installed: 2.4.7]
- python-dateutil [required: >=2.7, installed: 2.8.2]
- six [required: >=1.5, installed: 1.16.0]
opencv-python==4.5.3.56
- numpy [required: >=1.19.3, installed: 1.21.1]
pandas==1.3.1
- numpy [required: >=1.17.3, installed: 1.21.1]
- python-dateutil [required: >=2.7.3, installed: 2.8.2]
- six [required: >=1.5, installed: 1.16.0]
- pytz [required: >=2017.3, installed: 2021.1]
rawpy==0.16.0
- numpy [required: Any, installed: 1.21.1]
torchvision==0.10.0
- numpy [required: Any, installed: 1.21.1]
- pillow [required: >=5.3.0, installed: 8.3.1]
- torch [required: ==1.9.0, installed: 1.9.0]
- typing-extensions [required: Any, installed: 3.10.0.0]
然而,当我尝试调用为其创建环境的脚本时,我得到:
(imseg-cT2t34Fc) C:\Users\jp\Documents\programming\imseg\src>python3 model.py
Traceback (most recent call last):
File "C:\Users\jp\Documents\programming\imseg\src\model.py", line 14, in <module>
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
我阅读并尝试过
pip install pipx
pipx install pipenv
问题没有改变。我的 pipenv 环境有什么问题?
编辑:
where python3
返回:
C:\OSGeo4W\bin\python3.exe
C:\OSGeo4W\apps\Python39\python3.exe
C:\Users\jp\AppData\Local\Microsoft\WindowsApps\python3.exe
编辑(#2):我不清楚python可执行文件应该存在哪里?我想我没有得到虚拟环境的东西。如果python可执行文件应该存在于虚拟环境中,为什么python可执行文件没有安装在虚拟环境中。开始?pipenv 网站只是说有 python 并且我安装了 as pip3 install --user pipenv
,所以它看起来应该可以工作。我仍然想知道如何解决这个问题。