未激活python时安装到virtualenv的软件包

时间:2019-02-02 01:42:50

标签: python virtualenv

我在~/bot/子文件夹中的venv上安装了virtualenv。

我最近注意到,即使重启后,使用pip install --user甚至sudo pip install安装软件包也会安装到此virtualenv中。 Python在~/bot/~中似乎看不到python -m site

$ python -m site
sys.path = [
    '/home/modelmat',
    '/usr/lib/python37.zip',
    '/usr/lib/python3.7',
    '/usr/lib/python3.7/lib-dynload',
    '/home/modelmat/.local/lib/python3.7/site-packages',
    '/usr/lib/python3.7/site-packages',
    '/usr/lib/python3.7/site-packages/keyrings.alt-3.0-py3.7.egg',
    '/usr/lib/python3.7/site-packages/zgitignore-0.8.0-py3.7.egg',
    '/usr/lib/python3.7/site-packages/urllib3-1.22-py3.7.egg',
    '/usr/lib/python3.7/site-packages/SecretStorage-2.3.1-py3.7.egg',
    '/usr/lib/python3.7/site-packages/requests-2.18.4-py3.7.egg',
    '/usr/lib/python3.7/site-packages/python_dateutil-2.7.0-py3.7.egg',
    '/usr/lib/python3.7/site-packages/pycparser-2.18-py3.7.egg',
    '/usr/lib/python3.7/site-packages/psutil-5.4.3-py3.7-linux-x86_64.egg',
    '/usr/lib/python3.7/site-packages/onedrivesdk-1.1.8-py3.7.egg',
    '/usr/lib/python3.7/site-packages/keyring-11.0.0-py3.7.egg',
    '/usr/lib/python3.7/site-packages/inotify_simple-1.1.7-py3.7.egg',
    '/usr/lib/python3.7/site-packages/idna-2.6-py3.7.egg',
    '/usr/lib/python3.7/site-packages/cryptography-2.1.4-py3.7-linux-x86_64.egg',
    '/usr/lib/python3.7/site-packages/colorama-0.3.9-py3.7.egg',
    '/usr/lib/python3.7/site-packages/click-6.7-py3.7.egg',
    '/usr/lib/python3.7/site-packages/cffi-1.11.5-py3.7-linux-x86_64.egg',
    '/usr/lib/python3.7/site-packages/certifi-2018.1.18-py3.7.egg',
    '/usr/lib/python3.7/site-packages/bidict-0.13.1-py3.7.egg',
    '/usr/lib/python3.7/site-packages/onedriveClient-2.0.1-py3.7.egg',
    '/usr/lib/python3.7/site-packages/six-1.11.0-py3.7.egg',
]
USER_BASE: '/home/modelmat/.local' (exists)
USER_SITE: '/home/modelmat/.local/lib/python3.7/site-packages' (exists)
ENABLE_USER_SITE: True

但是,这是软件包显示的内容:

$ pip show websocket-client
Name: websocket-client
Version: 0.54.0
Summary: WebSocket client for Python. hybi13 is supported.
Home-page: https://github.com/websocket-client/websocket-client.git
Author: liris
Author-email: liris.pp@gmail.com
License: BSD
Location: /home/modelmat/NormoBot/venv/lib/python3.7/site-packages
Requires: six
Required-by: 

重新安装:

$ sudo pip uninstall websocket-client
Uninstalling websocket-client-0.54.0:
  Would remove:
    /home/modelmat/bot/venv/bin/wsdump.py
    /home/modelmat/bot/venv/lib/python3.7/site-packages/websocket/*
    /home/modelmat/bot/venv/lib/python3.7/site-packages/websocket_client-0.54.0.dist-info/*
Proceed (y/n)? y
  Successfully uninstalled websocket-client-0.54.0
$ sudo pip install websocket-client
Collecting websocket-client
  Using cached https://files.pythonhosted.org/packages/26/2d/f749a5c82f6192d77ed061a38e02001afcba55fe8477336d26a950ab17ce/websocket_client-0.54.0-py2.py3-none-any.whl
Requirement already satisfied: six in ./bot/venv/lib/python3.7/site-packages (from websocket-client) (1.11.0)
Installing collected packages: websocket-client
Successfully installed websocket-client-0.54.0

这与上一个pip show相同。完全相同的事情发生在pip install --user上。

我真的不确定如何解决此问题,所有内容似乎都安装在我的virtualenv内部。

0 个答案:

没有答案