Maison > Questions et réponses > le corps du texte
背景:
使用Ubuntu 14.04 32位的虚拟机,装在virtualbox里面的。使用系统自带的Python2.7,然后使用sudo apt-get install python-pip安装的pip工具,接着使用pip install virtualenv 安装的虚拟环境。然后如下:
操作:
按照http://dormousehole.readthedocs.org/en/latest/ 这个网站的教程,创建好虚拟环境之后,进入虚拟环境中使用pip install flask 报错。
问题:
使用pip install flask 报错
代码:
(venv01) hyp@hyp-VB:~/myproject$ pip install flask
Collecting flask
/home/hyp/myproject/venv01/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/home/hyp/myproject/venv01/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Exception:
Traceback (most recent call last):
File "/home/hyp/myproject/venv01/local/lib/python2.7/site-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/home/hyp/myproject/venv01/local/lib/python2.7/site-packages/pip/commands/install.py", line 310, in run
wb.build(autobuilding=True)
File "/home/hyp/myproject/venv01/local/lib/python2.7/site-packages/pip/wheel.py", line 748, in build
self.requirement_set.prepare_files(self.finder)
File "/home/hyp/myproject/venv01/local/lib/python2.7/site-packages/pip/req/req_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/home/hyp/myproject/venv01/local/lib/python2.7/site-packages/pip/req/req_set.py", line 577, in _prepare_file
session=self.session, hashes=hashes)
File "/home/hyp/myproject/venv01/local/lib/python2.7/site-packages/pip/download.py", line 798, in unpack_url
unpack_file_url(link, location, download_dir, hashes=hashes)
File "/home/hyp/myproject/venv01/local/lib/python2.7/site-packages/pip/download.py", line 705, in unpack_file_url
unpack_file(from_path, location, content_type, link)
File "/home/hyp/myproject/venv01/local/lib/python2.7/site-packages/pip/utils/__init__.py", line 599, in unpack_file
flatten=not filename.endswith('.whl')
File "/home/hyp/myproject/venv01/local/lib/python2.7/site-packages/pip/utils/__init__.py", line 484, in unzip_file
zip = zipfile.ZipFile(zipfp, allowZip64=True)
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 811, in _RealGetContents
raise BadZipfile, "File is not a zip file"
BadZipfile: File is not a zip file
小弟初学Python Web,对于这个错误实在是找不到任何原因,新建了好几个虚拟环境依然安装报这个错,重新安装了pip工具也不行
PHP中文网2017-04-17 17:33:29
1 Il y a un problème de réseau. Le fichier zip téléchargé est peut-être endommagé. Cette possibilité est élevée-->Changez la source nationale (recherchez simplement)
2 N'est-ce pas une installation pip Flask
?
迷茫2017-04-17 17:33:29
Il existe actuellement d'autres méthodes d'implémentation, et vous pouvez parfaitement l'installer en utilisant la source Douban domestique. Je suppose que cela peut être dû au réseau