ValueError: jpeg 是必需的,除非使用 --disable-jpeg 明确禁用,中止

Posted

技术标签:

【中文标题】ValueError: jpeg 是必需的,除非使用 --disable-jpeg 明确禁用,中止【英文标题】:ValueError: jpeg is required unless explicitly disabled using --disable-jpeg, aborting 【发布时间】:2016-08-26 16:19:56 【问题描述】:

我尝试在 12.04 的 ubuntu 服务器上安装 reddit,但出现错误

请查看下面终端的行。请帮我修复它。 我在 ff 行 "sudo python setup.py develop"

之后收到此错误

我已经使用 PPA 安装了所有必要的依赖项

Cannot find Cython. Skipping Cython build.
Cannot find Baseplate. Skipping Thrift build.
running develop
Checking .pth file support in /usr/local/lib/python2.7/dist-packages/
/usr/bin/python -E -c pass
TEST PASSED: /usr/local/lib/python2.7/dist-packages/ appears to support .pth files
running egg_info
writing requirements to r2.egg-info/requires.txt
writing r2.egg-info/PKG-INFO
writing top-level names to r2.egg-info/top_level.txt
writing dependency_links to r2.egg-info/dependency_links.txt
writing entry points to r2.egg-info/entry_points.txt
reading manifest file 'r2.egg-info/SOURCES.txt'
writing manifest file 'r2.egg-info/SOURCES.txt'
running build_ext
copying build/lib.linux-x86_64-2.7/Cfilters.so -> 
Creating /usr/local/lib/python2.7/dist-packages/r2.egg-link (link to .)
r2 0.0.0dev is already the active version in easy-install.pth

Installed /home/reddit/reddit/r2
Processing dependencies for r2==0.0.0dev
Searching for Pillow
Reading http://pypi.python.org/simple/Pillow/
Best match: Pillow 3.2.0
Downloading https://pypi.python.org/packages/e2/af/0a3981fffc5cd43078eb8b1057702e0dd2d5771e5aaa36cbd140e32f8473/Pillow-3.2.0.tar.gz#md5=7cfd093c11205d9e2ebe3c51dfcad510
Processing Pillow-3.2.0.tar.gz
Running Pillow-3.2.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-72k68O/Pillow-3.2.0/egg-dist-tmp-auWCL6
warning: no files found matching '*.sh'
no previously-included directories found matching 'docs/_static'
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.editorconfig'
warning: no previously-included files found matching '.landscape.yaml'
warning: no previously-included files found matching 'appveyor.yml'
warning: no previously-included files found matching 'build_children.sh'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files matching '.git*' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
Traceback (most recent call last):
  File "setup.py", line 138, in <module>
    """,
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/develop.py", line 27, in run
    self.install_for_development()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/develop.py", line 105, in install_for_development
    self.process_distribution(None, self.dist, not self.no_deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 692, in process_distribution
    [requirement], self.local_index, self.easy_install
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 576, in resolve
    dist = best[req.key] = env.best_match(req, self, installer)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 821, in best_match
    return self.obtain(req, installer) # try and download/install
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 833, in obtain
    return installer(requirement)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 608, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 638, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 828, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1105, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1094, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 30, in run_setup
    lambda: execfile(
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 72, in run
    return func()
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 32, in <lambda>
    '__file__':setup_script, '__name__':'__main__'
  File "setup.py", line 767, in <module>

  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/bdist_egg.py", line 179, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/bdist_egg.py", line 166, in call_command
    self.run_command(cmdname)
  File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/install_lib.py", line 20, in run
    self.build()
  File "/usr/lib/python2.7/distutils/command/install_lib.py", line 111, in build
    self.run_command('build_ext')
  File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "setup.py", line 512, in build_extensions

ValueError: jpeg is required unless explicitly disabled using --disable-jpeg, aborting

【问题讨论】:

您是否尝试过使用--disable-jpeg 标志? 相关帖子:***.com/questions/34631806/… 【参考方案1】:

您可能需要一些额外的库才能使用 Pillow。对于 Ubuntu 12.04,您可以尝试来自 this question 的解决方案

sudo apt-get install libtiff4-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk

之前的解决方案建议先尝试安装libjpeg8-dev

【讨论】:

之后我收到一个新错误,线程 Thread-2 中的异常:回溯(最近一次调用最后一次):文件“/usr/lib/python2.7/threading.py”,第 551 行,在 bootstrap_inner self.run() 文件“/usr/lib/python2.7/threading.py”,第 504 行,在运行 self.__target(*self.__args, **self.__kwargs) 文件“/usr /lib/python2.7/multiprocessing/pool.py",第 319 行,在 _handle_tasks put(task) PicklingError: Can't pickle : attribute lookup __builtin.function failed 我尝试再做一次,现在我得到一个不同的错误:Installed /home/reddit/reddit/r2 Processing dependencies for r2==0.0.0dev Searching for l2cs>=2.0.2 Reading @ 987654322@ No local packages or download links found for l2cs>=2.0.2 错误:找不到 Requirement.parse('l2cs>=2.0.2') 的合适分发版 l2cs 看起来像一个已弃用的库。您可以尝试从github.com/kemitche/l2cs 手动安装它,但它似乎已从 pypi 中删除 如何安装这个模块? 刚刚在 Ubuntu 18.04 中使用来解决同样的错误。不得不用libtiff5-dev 替换libtiff4-dev,但它起作用了。

以上是关于ValueError: jpeg 是必需的,除非使用 --disable-jpeg 明确禁用,中止的主要内容,如果未能解决你的问题,请参考以下文章

ValueError at /(未设置必需的参数名称)

jpeg_Ca 类使用说明

php strtr()函数 语法

Django - 字典更新序列元素#0 的长度为 1; 2是必需的[重复]

twitter.com 如何使 JPEG 个人资料图像透明?

如何使外键成为必需?