linux下pip使用可能遇到的问题
2017-07-31 21:17
597 查看
今天想在实验楼上找项目练练手,为了偷懒,linux环境直接就用了win10内置的WSL(Windows内置的Ubuntu子系统,有着比虚拟机更高的系统权限,而且文件目录跟windows下一致)。在使用pip安装pillow库时出现了问题,解决后记录如下:
1、lgc@Orankarl:~/.pip$ sudo pip install pillow
The directory '/home/lgc/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/lgc/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pillow
python: ../sysdeps/posix/getaddrinfo.c:2591: getaddrinfo: Assertion `(__extension__ ({ const struct in6_addr *__a = (const struct in6_addr *) (sin6->sin6_addr.__in6_u.__u6_addr32); __a->__in6_u.__u6_addr32[0] == 0 && __a->__in6_u.__u6_addr32[1] == 0 && __a->__in6_u.__u6_addr32[2] == __bswap_32 (0xffff); }))' failed.
经过查资料得知,这种问题提示原因是在pip命令中使用了sudo,切换了用户权限,导致user非当前user的情况发生。将sudo去掉即可。要记住,所有pip命令都不要加sudo。
2、lgc@Orankarl:/usr/local/lib/python2.7/dist-packages$ pip install pillow
Collecting pillow
/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: 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. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning. SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning
Using cached Pillow-4.2.1-cp27-cp27mu-manylinux1_x86_64.whl
Collecting olefile (from pillow)
Using cached olefile-0.44.zip
Installing collected packages: olefile, pillow
Running setup.py install for olefile ... done
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install
**kwargs
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 377, in move_wheel_files
clobber(source, dest, False, fixer=fixer, filter=filter)
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 323, in clobber
shutil.copyfile(srcfile, destfile)
File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/usr/local/bin/createfontdatachunk.py'
从最后一行可以看出,当前用户没有关于目录 /usr/local/bin/的权限,那么就给它权限好了,命令如下:
lgc@Orankarl:/usr/local/bin$ sudo chown -R lgc /usr/local/bin其后如果还有类似错误也如法炮制即可,最终成功安装pillow库。
1、lgc@Orankarl:~/.pip$ sudo pip install pillow
The directory '/home/lgc/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/lgc/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pillow
python: ../sysdeps/posix/getaddrinfo.c:2591: getaddrinfo: Assertion `(__extension__ ({ const struct in6_addr *__a = (const struct in6_addr *) (sin6->sin6_addr.__in6_u.__u6_addr32); __a->__in6_u.__u6_addr32[0] == 0 && __a->__in6_u.__u6_addr32[1] == 0 && __a->__in6_u.__u6_addr32[2] == __bswap_32 (0xffff); }))' failed.
经过查资料得知,这种问题提示原因是在pip命令中使用了sudo,切换了用户权限,导致user非当前user的情况发生。将sudo去掉即可。要记住,所有pip命令都不要加sudo。
2、lgc@Orankarl:/usr/local/lib/python2.7/dist-packages$ pip install pillow
Collecting pillow
/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: 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. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning. SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning
Using cached Pillow-4.2.1-cp27-cp27mu-manylinux1_x86_64.whl
Collecting olefile (from pillow)
Using cached olefile-0.44.zip
Installing collected packages: olefile, pillow
Running setup.py install for olefile ... done
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install
**kwargs
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 377, in move_wheel_files
clobber(source, dest, False, fixer=fixer, filter=filter)
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 323, in clobber
shutil.copyfile(srcfile, destfile)
File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/usr/local/bin/createfontdatachunk.py'
从最后一行可以看出,当前用户没有关于目录 /usr/local/bin/的权限,那么就给它权限好了,命令如下:
lgc@Orankarl:/usr/local/bin$ sudo chown -R lgc /usr/local/bin其后如果还有类似错误也如法炮制即可,最终成功安装pillow库。
相关文章推荐
- 在IIS 发布Web App时使用ArcGIS Server Local services可能遇到的问题
- 在Linux平台下安装JDK可能遇到的多种问题
- 使用gentoo做构建嵌入式linux时遇到的问题两则[原]
- 初试linux可能遇到的编译问题
- Android开发时 adb shel l的使用可能遇到的问题
- 在 appclient 中使用注射 EJB (injected EJB) 可能遇到的问题
- 使用BDC连接MySql可能遇到的问题
- linux使用遇到的一些小问题
- Linux下 android SDK安装及使用时出现的几个问题解决办法(我遇到的)
- Window访问Linux共享"您可能没有权限使用网络资源"问题解决
- 使用远程桌面的朋友可能经常会遇到“超出最大允许连接数”的问题,
- 关于在neoshine linux下使用电视卡遇到的问题和总结
- 在使用LYNC2010 客户端拨打国际长途时可能遇到的问题
- NUnit的使用中可能遇到的问题
- 使用SourceSafe管理软件开发可能遇到的问题及解决方法
- Linux使用过程中遇到的各种小问题集合
- 小结一下Linux下使用TCP通讯时遇到的问题
- 使用嵌入式linux完全手册光盘的arm-linux-gcc 遇到问题 自己编译
- 转帖:使用BDC连接MySql可能遇到的问题
- 使用密匙让putty(或ssh)自动登录Linux遇到几个问题的解决方法