[英]How to get rid of using --user in pip
I use to own a laptop with Ubuntu 18.04 and installing packages through the pycharm terminal with pip was a simple pip install foobar_package
.我曾经拥有一台装有 Ubuntu 18.04 的笔记本电脑,通过 pycharm 终端使用 pip 安装软件包是一个简单的
pip install foobar_package
。 Recently I replaced my laptop with a desktop and installed Ubuntu 18.04 on it as well.最近我用台式机替换了我的笔记本电脑,并在上面安装了 Ubuntu 18.04。 The problem I face is that when I run the default
pip install
command it tries to install the packages in the root python directory.我面临的问题是,当我运行默认的
pip install
命令时,它会尝试在根 python 目录中安装包。
The internet gave a solution in which I should just add --user
to the pip
command.互联网给出了一个解决方案,我应该在
pip
命令中添加--user
。 For example: pip install --user foobar_package
.例如:
pip install --user foobar_package
。 Although this works it is frustrating following a tutorial that require 5 pip packages to be installed and I have to insert the --user command manually whereas previously it was a simple copy and paste.尽管这有效,但遵循需要安装 5 个 pip 包的教程令人沮丧,我必须手动插入 --user 命令,而以前它是简单的复制和粘贴。
Can I setup pycharm terminal to always use the home user to install the packages in the venv?我可以将 pycharm 终端设置为始终使用家庭用户在 venv 中安装软件包吗?
I believe it has been solved in the pip version that (coincidentally) has been released earlier this week 20.0 (2020-01-21) (but this version has an issue so make sure to install 20.0.1 ).我相信它已经在本周早些时候(巧合)发布的pip版本20.0 (2020-01-21) 中解决了(但是这个版本有一个问题,所以一定要安装20.0.1 )。
See the release notes for pip 20.0 :请参阅pip 20.0的发行说明:
Default to doing a user install (as if --user was passed) when the main site-packages directory is not writeable and user site-packages are enabled.
当主站点包目录不可写且用户站点包已启用时,默认执行用户安装(就像传递了 --user 一样)。 ( #1668 )
(第1668章)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.