python-3.6 - 如何在python中安装light包?
问题描述
当我使用命令在 python 3.6.5 中安装 light 包时
pip install light
我收到此错误:
Collecting light
Using cached https://files.pythonhosted.org/packages/74/e5/78270f0aec7135793a85d4898b0075b741f7e2041011c24d8af76c9a3671/light-0.0.1.tar.gz
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Bhanu\AppData\Local\Temp\pip-install-p6x112xj\light\setup.py", line 43, in <module>
with open(os.path.join(thisdir, "requirements.txt"), "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Bhanu\\AppData\\Local\\Temp\\pip-install-p6x112xj\\light\\requirements.txt'
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in C:\Users\Bhanu\AppData\Local\Temp\pip-install-p6x112xj\light\
解决方案
看起来该项目不再维护。
如果您从 pypi ( light-0.0.1.tar.gz )下载整个源代码,将其解压到light-0.0.1目录,然后检查setup.py,则有一部分代码正在寻找requirements.txt文件:
42 install_requires = []
43 with open(os.path.join(thisdir, "requirements.txt"), "r") as f:
44 install_requires.extend(line.strip() for line in f.readlines() if line.strip())
45
但很明显requirements.txt不存在:
|- light
|- light.egg-info
|- PKG-INFO
|- setup.cfg
|- setup.py
您可以尝试在同一目录中创建一个空白requirements.txt文件,或者从setup.py中注释掉那些正在寻找requirements.txt的行:
install_requires = []
#with open(os.path.join(thisdir, "requirements.txt"), "r") as f:
# install_requires.extend(line.strip() for line in f.readlines() if line.strip())
然后手动安装包:
$ cd <path/to/light-0.0.1>
$ pip3 install .
它将成功安装。
不过,我建议远离这个包,因为它看起来不再维护或尚未准备好发布生产版本。
推荐阅读
- php - 如何使用 CURL 将原始数据转换为 php 中的 zip 文件?
- python - 在python中安装pytorch的问题 - ctypes.CDLL(dll) - OSError: [WinError 126] The specified module could not be found
- javascript - 我的代码是对的,但是eslint给我报错,怎么来的?
- python - 如何弹出一个图并等待响应
- javascript - 如何在这里解决 nodeJS 中的并发请求问题?
- c# - 绘制字符串时图形对象未使用正确的字体
- javascript - 为什么你不能增加价值?
- javascript - 打字稿声明地图类型
- vue.js - Firebase 邀请已弃用。使用 vue.js 和 firebase 设置用户邀请系统?
- linux - 在 Linux 上使用 actix-web + mongo 编译应用程序内存不足