python - 尝试测试我的 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 时,图书馆就会出现。
解决方案
如果您使用 pip for python2.x pip 安装包,但当您尝试为 python3.x 导入库时,通常会出现此问题
确保您正在为正确的 python 版本安装 pip 包。
推荐阅读
- python - 基于特定列分组并在 Python 中应用函数
- swift - 快速插入表格视图的问题
- python - 如何计算wav文件的瞬时频率
- php - 使用临时变量在php中无数组排序
- android - 在蓝牙 LE 连接中使用 ScanFilter 时没有回调
- ruby-on-rails - 如何为返回对象的方法编写控制器规范,但不检查任何相关模板
- python - Python 子实例属性似乎被父属性覆盖
- python - 如何在应用程序启动时删除备份日志
- json - 将字典 JSON 转换为 Typescript 模型
- javascript - 如何使用 Facebook api 在帖子中使用文章缩略图在 Facebook 上分享文章?