Python 板


LINE

环境是ubuntu 尝试发文请教,不过我猜应该没人知道 我尽可能地描述 想了解一下 linux的权限问题 以及 第三方库管理套件是否真的被移除 问题1 用第三方库pip3 安装套件 pip3 install jupyter 没加sudo 无法找到 jupyter指令 即使重新安装 加上sudo指令也无法使用 这个我真不知道怎麽改善 若不是使用虚拟机可以回复初始状态 我就卡死在这边 若一开始就用以下指令 sudo pip3 install jupyter 可以找到jupyter指令 可正常使用 问题2 sudo pip3 install jupyter 安装时会出现警告,建议我或许可以加上-H 加上-H後确实不会出现警告 但是我不明白-H有什麽作用 又是为了什麽? 以下是测试过程的描述及图片 都是用虚拟机 回复初始状态 分3种情况 测试jupyter指令 1.sudo pip3 install jupyter 2.sudo -H pip3 install jupyter 3.pip3 install jupyter ------------------------------------------------------------------------ sudo apt-get install python3-pip 顺利执行安装 whereis pip3 pip3: /usr/bin/pip3 /usr/share/man/man1/pip3.1.gz which pip3 /usr/bin/pip3 ------------------------------------------------------------------------ 再来使用pip3安装套件 sudo pip3 install jupyter 出现警告 但依然执行安装 The directory '/home/caesar/.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. https://imgur.com/ioCZTJa.jpg
安装jupyter後,测试jupyter指令 https://imgur.com/vsjlOn8.jpg
pip3 uninstall jupyter 执行失败,权限不足 https://i.imgur.com/q5jJD5s.jpg sudo pip3 uninstall jupyter 出现警告 ,解安装成功 反安装jupyter後,测试jupyter指令 单独执行 jupyter 还是存在该指令 不是解安装了吗? 到底移除了什麽? 但若是用pip3 show jupyter 查询 则找不到jupyter套件 https://i.imgur.com/BTvL9o5.jpg ------------------------------------------------------------------------ 为了不出现警告 尝试加上参数-H sudo -H pip3 install jupyter 顺利安装 没出现任何警告 查询了-H的功能 在stackoverflow 看到以下这篇 https://stackoverflow.com/questions/43623025/what-does-sudo-h-do 但依然不太了解 加上-H 跟 没加上的差异 是为了什麽? 安装jupyter後,测试jupyter指令 感觉跟没用-H的 看起来相同 https://i.imgur.com/TKNoSmF.jpg 反安装jupyter 加上-H 不会出现警告 不明白有什麽差异 为了什麽目的 他建议我加上-H ? https://i.imgur.com/cdh7ch3.jpg ------------------------------------------------------------------------ 使用pip3安装套件 但是不加上sudo pip3 install jupyter 没出现警报 正常安装 安装jupyter後,测试jupyter指令 找不到jupyter指令 我自己可以发现的差异只有 加上sudo的安装 使用pip3 show jupyter 其安装位置 /usr/local/lib/python3.6/dist-packages 没有sudo的安装 使用pip3 show jupyter 其安装位置 /home/caesar/.local/lib/python3.6/site-packages https://i.imgur.com/DSDSVyO.jpg 由於jupyter指令 找不到 尝试 pip3 uninstall jupyter 解除安装 再用 sudo pip3 install jupyter 重新安装 安装过程 出现 许多Requirement already satisfied:... 例如: Requirement already satisfied: nbconvert in ./.local/lib/python3.6/site-packages (from jupyter) 感觉也不是真的重新安装? https://i.imgur.com/erH9I1U.jpg 重新加上sudo 安装 依然找不到jupyter指令 ------------------------------------------------------------------------ --



※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 111.241.13.97
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1526802657.A.BB4.html
1F:→ djshen: PATH 05/20 16:07
2F:推 TitanEric: 看过一篇文章是不要用sudo pip 05/20 22:16
3F:→ TitanEric: 好像都推荐用pip install xxx --user的样子 05/20 22:16
你说的那篇 应该类似这原因 https://bit.ly/2LepC9a There was recently malicious code included in pypi. Never use sudo to install with pip. This is the same as running a virus as root. Either add your local folder to your PATH or use a virtualenv. 但是 单纯用 pip3 uninstall jupyter 就是 没办法使用 jupyter指令 似乎要另外增加到 $PATH 如果一开始用 sudo pip3 install jupyter 可以使用 jupyter指令 在解除安装 sudo pip3 uninstall jupyter 似乎只移除了/usr/local/lib/python3.6/dist-packages/jupyter-1.0.0.dist-info /usr/local/bin 还是存在 jupyter 档案 所以 解除安装後 还是可以使用 jupyter指令 这种种都让我疑惑 ※ 编辑: x246libra (111.241.13.97), 05/20/2018 22:33:09
4F:推 TitanEric: 试试sudo apt auto-remove? 05/21 00:29
5F:推 s860134: 善用 which 你才能知道你执行的 pip 是谁 05/21 19:50
6F:→ s860134: 有没 sudo 的差别可以用env 检查看看 05/21 19:59
7F:→ s860134: 他安装位置不同应该差在环境变数不一样 05/21 20:00







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Tech_Job站内搜寻

TOP