一个不清楚的 requirements.txt 错误导致无法安装

问题描述

从今天开始,我在从 requirements.txt 安装模块时开始出现错误,我试图找到错误模块并将其删除,但我找不到。

Pillow
nospamplus
pymediainfo
apscheduler
howdoi
pySEOanalyzer
pokedex.py
faker
deep_translator
pornhub-api
countryinfo
emoji-country-flag
langdetect
PyProxyToolkit
cairosvg
grapheme
cryptosteganography
QScintilla
requests_html
flask
yahoo_fin
anime_downloader
pandas
PyDictionary
fontTools
pydub
quote
lottie
textblob
python-magic
glitch_this
PyGithub
PyTesseract
youtube-dl
opencv-contrib-python
telethon
iplookup
wget
numpy
googletrans
pyshorteners
aiohttp
bs4
coffeehouse
cowpy
emoji
gTTS-token>=1.1.3
gTTS>=2.0.1
geopy
gitpython
google-api-python-client==1.8.0
google-auth-oauthlib
google_images_download>=2.7.1
gsearch
hachoir
heroku3
httplib2
humanize
lxml
lyricsgenius
oauth2client
psycopg2-binary
PyLyrics
pySmartDL
pybase64>=0.4.0
pyfiglet
pylast
python-barcode
python-dotenv
pytz
qrcode
regex
requests
search-engine-parser>=0.4.2
selenium
speedtest-cli>=2.0.2
sqlalchemy>=1.2
telegraph
tswift
urbandict>=0.5
wikipedia>=1.4.0
youtube-search
password_strength
pyjokes
cryptocompare

这些是模块。 以下是我得到的错误

Collecting goslate
  Downloading goslate-1.5.1.tar.gz (17 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u0eft0x8/goslate_a9d50754d502446c876c20f9eb75ad67/setup.py'"'"'; __file__='"'"'/tmp/pip-install-u0eft0x8/goslate_a9d50754d502446c876c20f9eb75ad67/setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-tybqx6p2
         cwd: /tmp/pip-install-u0eft0x8/goslate_a9d50754d502446c876c20f9eb75ad67/
    Complete output (26 lines):
    running egg_info
    creating /tmp/pip-pip-egg-info-tybqx6p2/goslate.egg-info
    writing /tmp/pip-pip-egg-info-tybqx6p2/goslate.egg-info/PKG-INFO
    Traceback (most recent call last):
      File "<string>",line 1,in <module>
      File "/tmp/pip-install-u0eft0x8/goslate_a9d50754d502446c876c20f9eb75ad67/setup.py",line 19,in <module>
        setup(
      File "/usr/local/lib/python3.9/dist-packages/setuptools/__init__.py",line 153,in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.9/distutils/core.py",line 148,in setup
        dist.run_commands()
      File "/usr/lib/python3.9/distutils/dist.py",line 966,in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.9/distutils/dist.py",line 985,in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.9/dist-packages/setuptools/command/egg_info.py",line 292,in run
        writer(self,ep.name,os.path.join(self.egg_info,ep.name))
      File "/usr/local/lib/python3.9/dist-packages/setuptools/command/egg_info.py",line 628,in write_pkg_info
        Metadata.write_pkg_info(cmd.egg_info)
      File "/usr/lib/python3.9/distutils/dist.py",line 1117,in write_pkg_info
        self.write_pkg_file(pkg_info)
      File "/usr/local/lib/python3.9/dist-packages/setuptools/dist.py",line 140,in write_pkg_file
        write_field('Summary',single_line(self.get_description()))
      File "/usr/local/lib/python3.9/dist-packages/setuptools/dist.py",line 124,in single_line
        raise ValueError("newlines not allowed")
    ValueError: newlines not allowed
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
The command '/bin/sh -c pip3 install -r requirements.txt' returned a non-zero code: 1

我尝试查找并删除 goslate 模块,但找不到。也许我的一个模块需要这个 goslate

解决方法

创建所有依赖项的列表并运行以下代码。

for l in list:
 print('checking for {}'.format(l))
 url = 'https://pypi.org/pypi/{}/json'
 json = requests.get(url.format(l)).json()
 if json['info']['requires_dist'] is not None:
         if 'goslate' in json['info']['requires_dist']:
                 print('found one ! : {}'.format(l))

这将检查 goslate 是否在您需要的任何模块中。

从这里获得帮助How to list dependencies for a python library without installing?

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...