Installed packages with pip are not shown in pip freeze?

前端 未结 1 867
面向向阳花
面向向阳花 2021-01-18 11:31

I\'m using virtualenv and pip on Debian Wheezy. I\'m having an odd problem where packages appear to install OK, but then aren\'t visible in the vir

1条回答
  •  再見小時候
    2021-01-18 11:47

    Your problem is that you've installed requirements with sudo and they were installed in your system python library folder instead and not in your virtual environment's venv library.

    What to do? Run the same command but this time without sudo: pip install -r requirements.txt. This will run pip from the virtual environment and install packages to the right place.

    When you activate a virtual environment e.q with source path/to/my/venv/bin/acivate the path variable $PATH of your current user is updated and then when you run something with sudo, this new $PATH that you've just updated when activating the virtual environment is no longer the same. Same thing happens when you open a new shell window or logs in as a different user with su or running sudo, $PATH variable is not a global system one.

    0 讨论(0)
提交回复
热议问题