我刚刚用以下命令在我的项目中创建了我的虚拟环境:python -m virtualenv venv', and I activated it. I tried to install files from the requirements.txt file with the command
pip install -r requirements.txt'。我在这两种情况下都尝试了venv on或of。在需求文件中有一些普通包和一些私有包。当安装最后一个私有包时,出现以下错误:
Collecting Shapely==1.7.1
Using cached Shapely-1.7.1.tar.gz (383 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [10 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:UsersmpossAppDataLocalTemppip-install-5x5ouymyshapely_bf50a01d45e7491aabfe1d2febea9725setup.py", line 85, in <module>
from shapely._buildcfg import geos_version_string, geos_version,
File "C:UsersmpossAppDataLocalTemppip-install-5x5ouymyshapely_bf50a01d45e7491aabfe1d2febea9725shapely_buildcfg.py", line 205, in <module>
lgeos = CDLL("geos_c.dll")
File "C:Program FilesPython310libctypes__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'geos_c.dll' (or one of its dependencies). Try using the full path with constructor syntax.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
所以在形状安装时出现错误。阅读所有的requirements.txt文件,没有一个人在里面有shape。但也许其他软件包也需要它。我读了很多StackOverflow的答案,人们告诉我使用conda而不是pip,但我不能,因为我需要在这个虚拟环境中工作
如何解决这个问题?如果你可以,请帮助我。
我在Ubuntu上遇到了同样的问题,这个问题通过运行命令来解决:
sudo apt-get install libgeos-c1v5
尝试从这里下载geos_c.dll文件:https://www.dll-files.com/geos_c.dll.html,然后在您的pc系统目录中解压缩zip文件(例如C:WindowsSystem32 for windows from XP on)。然后将system目录添加到路径中,并按形状安装1.6.3。