简体   繁体   English

Pipenv 安装本地 package 但收到“ModuleNotFoundError: No module named”

[英]Pipenv installing a local package but getting "ModuleNotFoundError: No module named"

I have a local project which I am developing and I want to install it into my pipenv so that I can try running some scripts that use the code I have developed.我有一个正在开发的本地项目,我想将它安装到我的 pipenv 中,以便我可以尝试运行一些使用我开发的代码的脚本。

I created a very basic setup.py located in the root of the project ( mypackage/setup.py ):我创建了一个非常基本的 setup.py 位于项目的根目录( mypackage/setup.py ):

from setuptools import find_packages, setup

setup(
    name="mypackage",
    version="0.1",
    packages=find_packages(),
)

And have also added __init__.py files (although they are all empty, but that should be fine) into all of the desired directories within the project.并且还将__init__.py文件(虽然它们都是空的,但应该没问题)添加到项目中所有所需的目录中。

Then when I run pipenv install /Users/me/path/to/mypackage it tells me that it is installing 'mypackage', and then it even adds it to the pipfile.然后当我运行pipenv install /Users/me/path/to/mypackage它告诉我它正在安装“mypackage”,然后它甚至将它添加到 pipfile 中。

But then when I run the venv pipenv shell and try importing the package python -c 'import mypackage' (also tried using python3 but same result), I get the error: ModuleNotFoundError: No module named 'mypackage' . But then when I run the venv pipenv shell and try importing the package python -c 'import mypackage' (also tried using python3 but same result), I get the error: ModuleNotFoundError: No module named 'mypackage' .

I also tried to remove the venv pipenv --rm and re-install it pipenv install , but the same result.我还尝试删除 venv pipenv --rm并重新安装它pipenv install ,但结果相同。 So at this point I'm a bit stuck on what I should do.所以在这一点上,我有点坚持我应该做什么。

Not sure but try to see where your virtual environment is and list of packages inside it.不确定,但请尝试查看您的虚拟环境在哪里以及其中的软件包列表。

pipenv --where
pipenv --venv
pipenv graph

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ModuleNotFoundError:没有名为“passlib”的模块,即使在 pip 安装和 pipenv 安装之后 - ModuleNotFoundError: No module named 'passlib', even after pip installing and pipenv installing ModuleNotFoundError:pipenv 中没有名为“dlib”的模块 - ModuleNotFoundError: No module named 'dlib' in pipenv 开发一个新的包并获取ModuleNotFoundError:没有命名的模块 - developing a new package and getting ModuleNotFoundError: No module named pipenv 安装后出现“ModuleNotFoundError:没有名为‘yaml’的模块” - "ModuleNotFoundError: No module named 'yaml'" after pipenv install ModuleNotFoundError: 没有名为“的模块”<package> &#39; - ModuleNotFoundError: No module named '<package>' ModuleNotFoundError:安装 email package 时没有名为“cStringIO”的模块 - ModuleNotFoundError: No module named 'cStringIO' when installing email package ModuleNotFoundError:将python3安装到本地文件夹后,没有名为“ _socket”的模块 - ModuleNotFoundError: No module named '_socket' after installing python3 to a local folder ModuleNotFoundError:ubuntu 上没有名为“包”的模块 - ModuleNotFoundError: No module named 'package' on ubuntu Pipenv“ModuleNotFoundError:升级到python3.7后没有名为&#39;pip&#39;的模块” - Pipenv "ModuleNotFoundError: No module named 'pip'" after upgrading to python3.7 pipenv 安装 package 在没有安装 pip 的情况下发生“ModuleNotFoundError” - pipenv installing package is occuring `ModuleNotFoundError` without pip install
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM