我在windows 7 32bit上使用Pycharm,我正在学习使用django做一个网站。我正在尝试做imagefield,所以我试图在命令窗口中安装Pillow,它给我这个错误。
(venv) C:\Users\مرحبا\PycharmProjects\TryDjango>py -m pip install Pillow
Collecting Pillow
Exception:
Traceback (most recent call last):
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_internal\basecommand.py", line 228, in main
status = self.run(options, args)
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_internal\commands\install.py", line 291, in run
resolver.resolve(requirement_set)
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_internal\resolve.py", line 103, in resolve
self._resolve_one(requirement_set, req)
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_internal\resolve.py", line 257, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_internal\resolve.py", line 210, in _get_abstract_dist_for
self.require_hashes
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_internal\operations\prepare.py", line 245, in
prepare_linked_requirement
req.populate_link(finder, upgrade_allowed, require_hashes)
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_internal\req\req_install.py", line 307, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_internal\index.py", line 484, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_internal\index.py", line 442, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_internal\index.py", line 587, in _get_pages
page = self._get_page(location)
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_internal\index.py", line 705, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_internal\index.py", line 814, in get_page
"Cache-Control": "max-age=600",
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_vendor\requests\sessions.py", line 521, in get
return self.request('GET', url, **kwargs)
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_internal\download.py", line 397, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_vendor\requests\sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_vendor\requests\sessions.py", line 658, in send
r.content
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_vendor\requests\models.py", line 823, in content
self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_vendor\requests\models.py", line 745, in generate
for chunk in self.raw.stream(chunk_size, decode_content=True):
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_vendor\urllib3\response.py", line 436, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_vendor\urllib3\response.py", line 384, in read
data = self._fp.read(amt)
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_vendor\cachecontrol\filewrapper.py", line 63, in read
self._close()
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_vendor\cachecontrol\filewrapper.py", line 50, in _close
self.__callback(self.__buf.getvalue())
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_vendor\cachecontrol\controller.py", line 296, in cache_response
self.serializer.dumps(request, response, body=body),
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_internal\download.py", line 298, in set
return super(SafeFileCache, self).set(*args, **kwargs)
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_vendor\cachecontrol\caches\file_cache.py", line 113, in set
with self.lock_class(name) as lock:
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_vendor\lockfile\mkdirlockfile.py", line 19, in __init__
LockBase.__init__(self, path, threaded, timeout)
File "C:\Users\مرحبا\AppData\Local\Programs\lib\site-
packages\pip\_vendor\lockfile\__init__.py", line 226, in __init__
self.tname = '-%x' % (ident & 0xffffffff)
TypeError: unsupported operand type(s) for &: 'method' and 'int'
其实我是初学者,请告诉我该怎么做,我在最后一步完成我的第一个网站,我需要安装枕头,以便在我的模型中制作imageefield.could you help me please?
先试试下面的方法
pip install Pillow
如果以上方法不奏效,请尝试以下方法--------------------------------------------------------。
pip3 install Pillow
编辑1:
如果pip显示错误,请执行以下操作---。
1) 检查你使用的是哪个版本的python。最新的版本是3.8。看看下面的命令是否显示错误?
python3
如果上面的命令显示错误,那就意味着你可能需要从它的 网站.
2) 检查pip版本-
pip -V
# pip 20.0.2 from /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)
python3 -m pip install --upgrade pip
以上应该安装最新的pip版本(20.0.2)。然后尝试安装 Pillow
与 pip
.