问题
I installed a Python package using pip from git. In order to achieve this, I added the command
-e git+<link>#<egg>
to my requirements.txt. Pip installs this package, but not in the way I would like to have it.
First problem: I use a virtual environment. Usually, packages end up in <env>/Lib/site-packages
. This one does not, it ends up in <env>/src
. This makes it more to difficult to import.
Second problem: The src
folder also gets created within my actual project, the one I am working on.
Both things are different to installing packages from other sources like PyPI. Is there a way to install my own packages via git in the same way? I actual built a wheel and a tar.gz, but I don't know how to install them ...
回答1:
@AnthonySottile's comment pointed me into the right direction: The -e
option makes the installed package editable, which is not what I wanted. It actually works without it!
So if you want to avoid having src
folders appearing everywhere - download from git without the -e option:
git+<link>#<egg>
Unfortunately, I didn't find any documentation for this ... so feel free to post a more profound answer or add to this one.
来源:https://stackoverflow.com/questions/63904632/install-package-using-pip-from-git-into-site-packages