【发布时间】:2019-01-02 02:05:58
【问题描述】:
我有一个 python 包上传到 GitHub。这个包使用 Pipenv 来管理依赖。另一方面,我有一个使用该库的 python 工具(并使用 Pipenv 来管理它自己的依赖项)。
查看我的包的Pipfile,我们可以看到它有两个依赖:
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
requests = "*"
loggly-python-handler = "*"
[dev-packages]
pylint = "*"
[requires]
python_version = "3.7"
在我的 python 工具中,我使用以下方法安装了我的包:
pipenv install -e git+https://github.com/<name>/<name>.git#egg=<name>
但是,当检查该工具的 pip 图时,我的包似乎没有依赖关系:
(tool-aqleTTYE) C:\Projects\tool>pipenv graph
<my_package>==0.0.3
pylint==2.0.1
- astroid [required: >=2.0.1, installed: 2.0.1]
- lazy-object-proxy [required: Any, installed: 1.3.1]
- six [required: Any, installed: 1.11.0]
- wrapt [required: Any, installed: 1.10.11]
- colorama [required: Any, installed: 0.3.9]
- isort [required: >=4.2.5, installed: 4.3.4]
- mccabe [required: Any, installed: 0.6.1]
我希望看到我的包依赖于requests 和loggly-python-handler。事实上,在运行代码时,它说它找不到包依赖项..
pipenv run python tool.py
....
File "c:\.virtualenvs\tool-aqlettye\src\tool\tool\logger.py", line 35, in <module>
'level': 'DEBUG',
File "c:\python37\Lib\logging\config.py", line 792, in dictConfig
dictConfigClass(config).configure()
File "c:\python37\Lib\logging\config.py", line 563, in configure
'%r' % name) from e
ValueError: Unable to configure handler 'loggly'
为了确定:
(tool-aqleTTYE) C:\Projects\tool>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 requests
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'requests'
这是一个错误还是我做错了什么?
【问题讨论】:
标签: python github package virtualenv pipenv