
Ich versuche, den Pymemcache unter Ubuntu 17.04 mit pip zu installieren und erhalte den folgenden Fehler. Das Modul wird jedoch ohne die Option -t installiert. Ich möchte das Modul jedoch in einem bestimmten Verzeichnis installieren, damit ich es verpacken und in die Cloud hochladen kann.
Kann mir bitte jemand weiterhelfen?
pip install -t /home/praveen/Code/AWS/Lambda/Memcached-Py pymemcache
Collecting pymemcache
Using cached pymemcache-1.4.3-py2.py3-none-any.whl
Collecting six (from pymemcache)
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six, pymemcache
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 360, in run
prefix=options.prefix_path,
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 247, in move_wheel_files
prefix=prefix,
File "/usr/lib/python2.7/dist-packages/pip/locations.py", line 153, in distutils_scheme
i.finalize_options()
File "/usr/lib/python2.7/distutils/command/install.py", line 289, in finalize_options
raise DistutilsOptionError("can't combine user with prefix, "
DistutilsOptionError: can't combine user with prefix, exec_prefix/home, or install_(plat)base
Antwort1
Dieses Problem wird durch einen Konflikt zwischen der expliziten -t
Option und der impliziten --user
Option verursacht, der in der gepatchten Version von Ubuntu vorhanden ist pip
. Dies wird im pip
GitHub-Repository von unter beschrieben.https://github.com/pypa/pip/issues/3826Undhttps://github.com/pypa/pip/issues/4390.
Um dies zu umgehen, würde ich die Verwendung einer virtuellen Umgebung vorschlagen. Die Schritte sind wie folgt:
Installieren Sie es
virtualenv
, falls Sie dies noch nicht getan haben:sudo apt update sudo apt install virtualenv
Erstellen und aktivieren Sie eine virtuelle Umgebung und führen Sie ein Upgrade durch
pip
:virtualenv venv source venv/bin/activate pip install -U pip
Installieren Sie es
pymemcache
in Ihrem angegebenen Verzeichnis mit der-t
Option:pip install -t /home/praveen/Code/AWS/Lambda/Memcached-Py pymemcache