简体   繁体   English

使用 Pycharm 安装 Pillow 失败

[英]Failled to install Pillow using Pycharm

I am using Pycharm on windows 7 32bit, i am learning to make a website using django.我在 windows 7 32 位上使用 Pycharm,我正在学习使用 django 制作网站。 i am trying to make imagefield, so i tried to install Pillow in the command window and it give me this error:我正在尝试制作 imagefield,所以我尝试在命令 window 中安装 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'

actually i am beginner, please tell me what to do, i am at the last step to finish my first website, and i need to install the pillow in order to make imagefield in my model.实际上我是初学者,请告诉我该怎么做,我在完成我的第一个网站的最后一步,我需要安装枕头才能在我的 model 中制作图像场。 could you help me Please?请问你能帮帮我吗?

First try the following-首先尝试以下 -

pip install Pillow

If the above doesn't work, try the following-如果上述方法不起作用,请尝试以下方法 -

pip3 install Pillow

Edit 1:编辑1:

If pip is showing error, do the following-如果 pip 显示错误,请执行以下操作 -

1) Check which version of python you are using. 1) 检查您使用的是哪个版本的 python。 The latest version is 3.8.最新版本是 3.8。 See if the following shows any error?看看下面有没有报错?

python3

If the above command shows error, that means you may need to install the latest version of python from its website .如果上述命令显示错误,则意味着您可能需要从其网站安装最新版本的 python。

2) Check the pip version- 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

The above should install the lates pip version (20.0.2).以上应安装最新的pip版本(20.0.2)。 Then try to install Pillow with pip .然后尝试使用pip安装Pillow

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM