如何在python中安装light包?

时间:2019-06-09 16:21:38

标签: python-3.6

当我使用命令在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\

2 个答案:

答案 0 :(得分:0)

如果您使用的是python 3,则需要使用pip3来安装软件包,除非您已使用python 3激活了虚拟环境

答案 1 :(得分:0)

似乎不再维护该项目。

如果您从pypi(light-0.0.1.tar.gz)下载整个源,请将其解压缩到 light-0.0.1 目录,然后检查 setup.py ,其中有一部分代码正在寻找 requirements.txt 文件:

G:\>python g:\pypkg\src\app.py
[   'g:\\pypkg\\src',
    'C:\\Apps\\Csound6_x64\\bin',
    'G:\\',
    'C:\\Python\\Python37\\python37.zip',
    'C:\\Python\\Python37\\DLLs',
    'C:\\Python\\Python37\\lib',
    'C:\\Python\\Python37',
    'C:\\Python\\Python37\\lib\\site-packages']
this is app.
this is func from util.
[   'g:\\pypkg\\src',
    'C:\\Apps\\Csound6_x64\\bin',
    'G:\\',
    'C:\\Python\\Python37\\python37.zip',
    'C:\\Python\\Python37\\DLLs',
    'C:\\Python\\Python37\\lib',
    'C:\\Python\\Python37',
    'C:\\Python\\Python37\\lib\\site-packages']

但是很明显, 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 文件,或注释掉 setup.py 中正在寻找 requirements.txt的行。

|- light
|- light.egg-info
|- PKG-INFO
|- setup.cfg
|- setup.py

然后手动安装软件包:

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())

它将成功安装。

但是,我建议您不要使用此软件包,因为它似乎已不再维护或尚未准备好用于生产版本。