liusanye@DESKTOP-O9QRQ7C:~$ pip3 install xlwt Collecting xlwt Downloading xlwt-1.3.0-py2.py3-none-any.whl (99kB) 100% |████████████████████████████████| 102kB 22kB/s Installing collected packages: xlwt Exception: Traceback (most recent call last): File "/home/liusanye/.local/lib/python3.5/site-packages/pip/basecommand.py", l ine 215, in main status = self.run(options, args) File "/home/liusanye/.local/lib/python3.5/site-packages/pip/commands/install.p y", line 342, in run prefix=options.prefix_path, File "/home/liusanye/.local/lib/python3.5/site-packages/pip/req/req_set.py", l ine 784, in install **kwargs File "/home/liusanye/.local/lib/python3.5/site-packages/pip/req/req_install.py ", line 851, in install self.move_wheel_files(self.source_dir, root=root, prefix=prefix) File "/home/liusanye/.local/lib/python3.5/site-packages/pip/req/req_install.py ", line 1064, in move_wheel_files isolated=self.isolated, File "/home/liusanye/.local/lib/python3.5/site-packages/pip/wheel.py", line 34 5, in move_wheel_files clobber(source, lib_dir, True) File "/home/liusanye/.local/lib/python3.5/site-packages/pip/wheel.py", line 31 6, in clobber ensure_dir(destdir) File "/home/liusanye/.local/lib/python3.5/site-packages/pip/utils/init.py" , line 83, in ensure_dir os.makedirs(path) File "/usr/lib/python3.5/os.py", line 241, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-pa ckages/xlwt'
1
vyronlee 2018-02-08 00:31:58 +08:00 via iPhone
加 sudo
|
2
litanid 2018-02-08 01:16:10 +08:00
也可以试下 python3 -m pip install
|
3
Comphuse 2018-02-08 01:49:54 +08:00 1
pip3 install --user 包名
看错误信息最后一行:Permission denied. pip 默认安装系统目录,以普通用户运行是没有权限的。加上 --user 会装到 ~/.local 下面。 参见: https://pip.pypa.io/en/stable/ |
4
Comphuse 2018-02-08 01:50:32 +08:00
另外除非你明确知道自己在干什么,不要 sudo pip。
|
5
ruoniao 2018-02-08 08:17:00 +08:00
好巧,昨天我同事也是,哈哈
|