在虚拟环境中安装pip软件包-pip忽略了venv

时间:2020-03-03 20:37:51

标签: ubuntu pip virtualenv python-venv

这是我名为udemy的虚拟环境。

yanaz@yanaz-Latitude-E6440:~$ source .venvs/udemy/bin/activate
(udemy) yanaz@yanaz-Latitude-E6440:~$ pip3 freeze
(udemy) yanaz@yanaz-Latitude-E6440:~$ which python3
/home/yanaz/.venvs/udemy/bin/python3
(udemy) yanaz@yanaz-Latitude-E6440:~$ which pip3
/home/yanaz/.venvs/udemy/bin/pip3

这些是我安装的python版本。 apt-get和其他版本安装了Python 3.6:根据本教程https://tecadmin.net/install-python-3-8-ubuntu/

安装了3.7、3.8
(udemy) yanaz@yanaz-Latitude-E6440:~$ which python3.6
/usr/bin/python3.6
(udemy) yanaz@yanaz-Latitude-E6440:~$ which python3.8
/usr/local/bin/python3.8
(udemy) yanaz@yanaz-Latitude-E6440:~$ which python3.7
/home/yanaz/.venvs/udemy/bin/python3.7

这是我尝试安装软件包时发生的情况。 Pip的工作方式就像我在虚拟环境之外一样(并且我已经在其中安装了Django)。

(udemy) yanaz@yanaz-Latitude-E6440:~$ sudo pip3 install Django==2.2.4
[sudo] hasło użytkownika yanaz:         
The directory '/home/yanaz/.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/yanaz/.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.
Requirement already satisfied: Django==2.2.4 in /usr/local/lib/python3.6/dist-packages
Requirement already satisfied: pytz in /usr/local/lib/python3.6/dist-packages (from Django==2.2.4)
Requirement already satisfied: sqlparse in /usr/local/lib/python3.6/dist-packages (from Django==2.2.4)

如何更改我的配置?

0 个答案:

没有答案