Python:使用pip3安装了本地软件包,但未找到模块错误 [英] Python: Installed a local package with pip3, but got module not found error

查看:630
本文介绍了Python:使用pip3安装了本地软件包,但未找到模块错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

程序:

  • I strictly followed the instructions here: https://python-packaging.readthedocs.io/en/latest/minimal.html
  • Except that I used the pip3 install -e .

错误:

它仍然找不到模块:

python3
Python 3.6.5 (default, Apr 25 2018, 14:26:36)
import funniest
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'funniest'

但是,当我在python中导入模块时,它可以找到它:

However, when I import the module in python, it CAN find it:

python
Python 2.7.10 (default, Feb  7 2017, 00:08:15)
import funniest

我的python:

sys.executable
'/usr/local/opt/python/bin/python3.6'

问题

为什么pip3为python 2.7而不是我的python 3.x安装了它?

Why pip3 installed it for python 2.7 not for my python 3.x ?

谢谢!

推荐答案

按照@hoefling的提示,我发现我的pip3有点链接到错误的python版本.

Following the hint from @hoefling, I found that my pip3 is somewhat linked to a wrong python version.

然后使用python3 -m pip install进行安装即可.

Then install with python3 -m pip install worked.

这篇关于Python:使用pip3安装了本地软件包,但未找到模块错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆