首页 > 解决方案 > 尝试测试我的 python 库,它已安装但未找到

问题描述

当我尝试在本地安装我的库并对其进行测试时,它显示为已安装:

PS C:\Projects\pypi\potatoutils> pip install -e .
Obtaining file:///C:/Projects/pypi/potatoutils
Installing collected packages: potatoutils
  Attempting uninstall: potatoutils
    Found existing installation: potatoutils 0.0.1
    Uninstalling potatoutils-0.0.1:
      Successfully uninstalled potatoutils-0.0.1
  Running setup.py develop for potatoutils
Successfully installed potatoutils

但是当我尝试测试它时

PS C:\Projects\pypi\potatoutils> python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import potatoutils

我收到此错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'potatoutils'

我究竟做错了什么?

编辑: pip 和 python 具有相同的版本(3.7)并且它们的路径匹配。

当我使用 pip list 时,图书馆就会出现。

标签: pythonpip

解决方案


如果您使用 pip for python2.x pip 安装包,但当您尝试为 python3.x 导入库时,通常会出现此问题

确保您正在为正确的 python 版本安装 pip 包。


推荐阅读