【问题标题】:Trying to test my python library, it's installed but not found尝试测试我的 python 库,它已安装但未找到
【发布时间】:2021-03-15 18:03:10
【问题描述】:

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

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 list在你安装了potatoutils之后检查它是否存在吗?
  • potatoutils 0.0.1 c:\projects\pypi\potatoutils 是的,它就在那里。

标签: python pip


【解决方案1】:

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

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

【讨论】:

  • pip 包适用于正确的版本并且路径匹配。
【解决方案2】:

使用 pip3 使用 pip 有时指向 python 2.x 版本,这就是为什么它可能会有所帮助!

【讨论】:

  • 已经试过了,还是不行。感谢您的尝试!
【解决方案3】:

好的,所以我设法通过重新开始并按照以下说明启动并运行库: https://medium.com/analytics-vidhya/how-to-create-a-python-library-7d5aea80cc3f 我仍然不知道第一次出了什么问题(可能是过时的说明?)但这对我来说不再重要。

【讨论】:

    猜你喜欢
    • 2022-12-07
    • 2015-06-16
    • 2016-06-01
    • 2020-03-15
    • 1970-01-01
    • 2023-03-29
    • 2021-06-11
    • 2012-08-10
    • 1970-01-01
    相关资源
    最近更新 更多