当我尝试在本地安装并测试我的库时,它显示为已安装:
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列表时,库就会显示出来
如果您使用pip for python2.x安装了一个包,这通常就是问题所在 但是,当您尝试为python3.x导入库时
确保正在运行安装正确python版本的pip包
好的,我通过重新开始并遵循以下说明,成功地启动并运行了库: https://medium.com/analytics-vidhya/how-to-create-a-python-library-7d5aea80cc3f 我仍然不知道第一次出了什么问题(可能是过时的说明?),但这对我来说已经不重要了
使用pip3使用pip有时会指向Python2.x版本,这就是为什么它可能会有所帮助
相关问题 更多 >
编程相关推荐