【发布时间】:2020-03-12 14:18:45
【问题描述】:
我正在使用 pipenv(版本 2018.11.26,Python 3.6.0)安装我创建并推送到私有 github 存储库的包。
包中包含一个 setup.py 文件,内容如下:
import setuptools
setuptools.setup(
name='testlib',
version='0.0.1',
desctiption='Hello py packaging',
packages=setuptools.find_packages()
)
我将包安装在一个虚拟环境中
pipenv install git+https://<token>@github.<private-repo>/<subdir>/testlib.git#egg=testlib
> Successfully installed testlib-0.0.1
并检查是否安装正确
$ pip freeze | grep testlib
> testlib==0.0.1
但如果我尝试导入模块,我会收到 ModuleNotFoundError
(.venv) pipenv_tests>python
Python 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 11:57:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import testlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'testlib'
>>>
谁能帮我理解为什么? 谢谢
【问题讨论】:
标签: python-3.x installation pipenv