geatpy作为一个第三方的库,在每次新建一个项目的时候是都需要重新安装一遍的,如果不安装那么在引用的时候就会出现问题
可以尝试用下面的方法解决
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
2.更新了镜像地址之后首先尝试安装numpy试试
pip install numpy
PS D:\python\python31\Scripts> pip install numpy
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting numpy
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/5b/e5/527451a9fb79e1cffe18ee74d79e8b8da44272a70bf924ec94143d956831/numpy-1.22.3-cp310-cp310-win_amd64.whl (14.7 MB)
Installing collected packages: numpy
Successfully installed numpy-1.22.3
安装成功
再试试安装geatpy
pip install geatpy
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting geatpy
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/79/cf/5e38e7ea391dcb2f5cdd8caab9868dd76650b18cb701b2a4180e8ad9f10d/geatpy-2.7.0-cp310-cp310-win_amd64.whl (4.1 MB)
Requirement already satisfied: numpy>=1.17.0 in d:\personal-data\python\qby_ga\python\lib\site-packages (from geatpy) (1.22.3)
Collecting matplotlib>=3.0.0
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/42/c6/5c8c25e1821b38c325816d46bf4ad47f9c890ab87039ab2a4db4246f1960/matplotlib-3.5.1-cp310-cp310-win_amd64.whl (7.2 MB)
Collecting cycler>=0.10
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/5c/f9/695d6bedebd747e5eb0fe8fad57b72fdf25411273a39791cde838d5a8f51/cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting kiwisolver>=1.0.1
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/37/97/cf42ffb6bd8d4f80cf8831b6786394941574cada008dd4b33886882c5edb/kiwisolver-1.4.2-cp310-cp310-win_amd64.whl (55 kB)
Collecting pyparsing>=2.2.1
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d9/41/d9cfb4410589805cd787f8a82cddd13142d9bf7449d12adf2d05a4a7d633/pyparsing-3.0.8-py3-none-any.whl (98 kB)
Collecting fonttools>=4.22.0
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/bc/83/43991c6f0dfb395cc9ccf5c19fd51fc6068cb3919cee4b78eddd4b16efd1/fonttools-4.32.0-py3-none-any.whl (900 kB)
Collecting packaging>=20.0
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/05/8e/8de486cbd03baba4deef4142bd643a3e7bbe954a784dc1bb17142572d127/packaging-21.3-py3-none-any.whl (40 kB)
Collecting python-dateutil>=2.7
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/36/7a/87837f39d0296e723bb9b62bbb257d0355c7f6128853c78955f57342a56d/python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting pillow>=6.2.0
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/a8/df/1177786a2d1c0bf732ba6d5f05a2fa40f016e81e1c16d62f1101e35d271e/Pillow-9.1.0-cp310-cp310-win_amd64.whl (3.3 MB)
Collecting six>=1.5
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: six, pyparsing, python-dateutil, pillow, packaging, kiwisolver, fonttools, cycler, matplotlib, geatpy
Successfully installed cycler-0.11.0 fonttools-4.32.0 geatpy-2.7.0 kiwisolver-1.4.2 matplotlib-3.5.1 packaging-21.3 pillow-9.1.0 pyparsing-3.0.8 python-dateutil-2.8.2 six-1.16.0
WARNING: You are using pip version 21.1.2; however, version 22.0.4 is available.
You should consider upgrading via the 'D:\personal-data\python\qby_GA\python\Scripts\python.exe -m pip install --upgrade pip' command.
PS D:\python\python31\Scripts>
显示geatpy安装成功
两个库都是安装成功的,只是提示需要更新pip
python -m pip install --upgrade pip
如有用请采纳