The package is installed via pip in the wrong directory (src) instead of site packages

I install this package in virtualenv using virtualenvwrapper and pip with this command:

pip install -e git+git://github.com/mr-stateradio/django-exchange.git#egg=django_exchange-master 

Interestingly, the package is then placed in the src folder, and not in the site packages folder, which I would expect. The package is placed in this folder:

 <path-to-my-virtual-env>/testenv/src/django-exchange-master/exchange 

Instead of this:

 <path-to-my-virtual-env>/testenv/lib/python2.7/site-packages 

I am assuming that something is wrong with the pip installation command that I am using, or with the setup.py package.

+6
source share
1 answer

The -e parameter tells pip to install packages in editable mode. "If you remove the -e option, pip installs the package in <venv path>/lib/Python_version/site-packages . Remember to remove the packages inside <venv path>/src , because that first python is looking for packages inside <venv path>/src .

pip supports installation from Git, Mercurial, Subversion and Bazaar and detects the VCS type using the url prefixes: "git +", "hg +", "bzr +", "svn +".

eg

 $ pip install -e git+https://git.repo/some_pkg.git#egg=SomePackage # from git $ pip install -e hg+https://hg.repo/some_pkg.git#egg=SomePackage # from mercurial $ pip install -e svn+svn://svn.repo/some_pkg/trunk/#egg=SomePackage # from svn $ pip install -e git+https://git.repo/ some_pkg.git@feature #egg=SomePackage # from 'feature' branch 

VCS projects can be installed in editable mode (using the -changeable option) or not.

  • For editable installations, the default clone location is <venv path>/src/SomeProject in virtual environments and <cwd>/src/SomeProject for global installations. The –src can be used to change this location.
  • For non-editable installations, the project is created locally in the temporary directory, and then installed normally. `
+9
source

Source: https://habr.com/ru/post/945986/


All Articles