Python 如何在virtualenv中安装Memcached

Python 如何在virtualenv中安装Memcached,python,Python,我正在尝试在virualenv中安装memcached python绑定: (env1)ubuntu@ip-172-31-28-196:~$ pip uninstall python-memcached Cannot uninstall requirement python-memcached, not installed (env1)ubuntu@ip-172-31-28-196:~$ pip install python-memcached Collecting python-memcach

我正在尝试在virualenv中安装memcached python绑定:

(env1)ubuntu@ip-172-31-28-196:~$ pip uninstall python-memcached
Cannot uninstall requirement python-memcached, not installed
(env1)ubuntu@ip-172-31-28-196:~$ pip install python-memcached
Collecting python-memcached
  Using cached python-memcached-1.53.tar.gz
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-build-x1yj76g5/python-memcached/setup.py", line 4, in <module>
        import memcache
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):    

      File "<string>", line 20, in <module>    

      File "/tmp/pip-build-x1yj76g5/python-memcached/setup.py", line 4, in <module>    

        import memcache    

    ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-x1yj76g5/python-me
mcached
(env1)ubuntu@ip-172-31-28-196:~$pip卸载python memcached
无法卸载未安装的python memcached
(环境1)ubuntu@ip-172-31-28-196:~$pip安装python memcached
收集python memcached
使用缓存的python-memcached-1.53.tar.gz
回溯(最近一次呼叫最后一次):
文件“”,第20行,在
文件“/tmp/pip-build-x1yj76g5/python memcached/setup.py”,第4行,在
导入memcache
从命令python setup.py egg_info完成输出:
回溯(最近一次呼叫最后一次):
文件“”,第20行,在
文件“/tmp/pip-build-x1yj76g5/python memcached/setup.py”,第4行,在
导入memcache
----------------------------------------
命令“python setup.py egg_info”失败,错误代码为1,位于/tmp/pip-build-x1yj76g5/python me中
麦卡奇
我怎样才能让它工作

编辑:

不搜索http://www.tummy.com/Community/software/python-memcached/ (来自https://pypi.python.
org/simple/python memcached/),因为不允许使用外部URL。
不搜索http://www.tummy.com/Community/software/python-memcached/ (来自https://pypi.python.
org/simple/python memcached/),因为不允许使用外部URL。
使用版本1.53(最新版本:1.53、1.52、1.51、1.48、1.47、1.31)
使用缓存的python-memcached-1.53.tar.gz
从URL下载https://pypi.python.org/packages/source/p/python-memcached/python-memcached-1
.53.tar.gz#md5=89570d26e7e7b15caa668a6b2678bd3c(从https://pypi.python.org/simple/python-memcache
d/)
运行setup.py(路径:/tmp/pip-build-j_435lge/python memcached/setup.py)包pyt的egg_信息
memcached议员
运行命令python setup.py egg\u info
回溯(最近一次呼叫最后一次):
文件“”,第20行,在
文件“/tmp/pip-build-j_435lge/python memcached/setup.py”,第4行,在
导入memcache
从命令python setup.py egg_info完成输出:
回溯(最近一次呼叫最后一次):
文件“”,第20行,在
文件“/tmp/pip-build-j_435lge/python memcached/setup.py”,第4行,在
导入memcache
----------------------------------------
清理。。。
命令“python setup.py egg_info”失败,错误代码为1,位于/tmp/pip-build-j_435; lge/python me中
麦卡奇
例外信息:
回溯(最近一次呼叫最后一次):
文件“/home/ubuntu/.virtualenvs/env1/lib/python3.4/site-packages/pip/basecommand.py”,第232行
,大体上
status=self.run(选项、参数)
文件“/home/ubuntu/.virtualenvs/env1/lib/python3.4/site-packages/pip/commands/install.py”,lin
e 339,在运行中
要求设置。准备文件(查找器)
文件“/home/ubuntu/.virtualenvs/env1/lib/python3.4/site packages/pip/req/req_set.py”,第385行
,在“准备文件”中
请求安装。运行\u egg\u info()
文件“/home/ubuntu/.virtualenvs/env1/lib/python3.4/site packages/pip/req/req_install.py”,第行
358,运行中\u蛋\u信息
命令\u desc='python setup.py egg\u info')
文件“/home/ubuntu/.virtualenvs/env1/lib/python3.4/site-packages/pip/utils/_-init__;.py”,第行
749,在call_子进程中
%(命令描述,过程返回代码,cwd))
pip.exceptions.InstallationError:命令“python setup.py egg_info”失败,错误代码为1
/tmp/pip-build-j_435; lge/python memcached
(环境1)ubuntu@ip-172-31-28-196:~$
编辑2:

 (env1)ubuntu@ip-172-31-28-196:~$ sudo apt-get install memcached
 Reading package lists... Done
 Building dependency tree
 Reading state information... Done
 memcached is already the newest version.
 The following packages were automatically installed and are no longer required:
   python-colorama python-distlib python-html5lib
 Use 'apt-get autoremove' to remove them.
 0 upgraded, 0 newly installed, 0 to remove and 70 not upgraded.
 (env1)ubuntu@ip-172-31-28-196:~$ pip install python-memcached
 Collecting python-memcached
   Using cached python-memcached-1.53.tar.gz
     Traceback (most recent call last):
       File "<string>", line 20, in <module>
       File "/tmp/pip-build-k_28hio4/python-memcached/setup.py", line 4, in <module>
         import memcache
     Complete output from command python setup.py egg_info:
     Traceback (most recent call last):     

       File "<string>", line 20, in <module>     

       File "/tmp/pip-build-k_28hio4/python-memcached/setup.py", line 4, in <module>     

         import memcache     

     ----------------------------------------
     Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-k_28hio4/python-me
 mcached
(env1)ubuntu@ip-172-31-28-196:~$sudo apt get安装memcached
正在阅读软件包列表。。。多恩
构建依赖树
正在读取状态信息。。。多恩
memcached已经是最新版本了。
以下软件包已自动安装,不再需要:
python-html5lib
使用“apt get autoremove”删除它们。
0已升级,0已新安装,0已删除,70未升级。
(环境1)ubuntu@ip-172-31-28-196:~$pip安装python memcached
收集python memcached
使用缓存的python-memcached-1.53.tar.gz
回溯(最近一次呼叫最后一次):
文件“”,第20行,在
文件“/tmp/pip-build-k_28hio4/python memcached/setup.py”,第4行,在
导入memcache
从命令python setup.py egg_info完成输出:
回溯(最近一次呼叫最后一次):
文件“”,第20行,在
文件“/tmp/pip-build-k_28hio4/python memcached/setup.py”,第4行,在
导入memcache
----------------------------------------
命令“python setup.py egg_info”失败,错误代码为1,位于/tmp/pip-build-k_28hio4/python me中
麦卡奇

也许您需要先安装memcached?
sudo apt get install memcached类似

似乎是一个隐藏实际问题的错误。尝试使用-vvv运行pip安装,也许我们可以获得更多信息。如果我们查看源代码,memcache应该可以由setup.py导入,它只导入六个,到那时应该解决依赖关系。看起来memcache引发了一些异常,对您来说变得不可导入。也许在python路径中解压归档文件,并尝试自己在解释器中导入memcache模块。对不起,我应该运行什么命令?我找不到'pip install with-vvv'pip install-vvv python memcached'的参考,也就是说,非常详细的输出如果问题确实来自python memcached setup.py(
import memcache
)的第4行,那么就是python解释器找不到memcache.py模块(目录不在python路径中)。临时解决方案是从setup.py中删除行
import memcache
,并用
version=“1.53”
替换
version=memcache.\uuuuuuuu
,然后使用
python setup.py install
,setup.py文件位于何处?没有“/tmp/pip-build-k28hio4/python memcache”
 (env1)ubuntu@ip-172-31-28-196:~$ sudo apt-get install memcached
 Reading package lists... Done
 Building dependency tree
 Reading state information... Done
 memcached is already the newest version.
 The following packages were automatically installed and are no longer required:
   python-colorama python-distlib python-html5lib
 Use 'apt-get autoremove' to remove them.
 0 upgraded, 0 newly installed, 0 to remove and 70 not upgraded.
 (env1)ubuntu@ip-172-31-28-196:~$ pip install python-memcached
 Collecting python-memcached
   Using cached python-memcached-1.53.tar.gz
     Traceback (most recent call last):
       File "<string>", line 20, in <module>
       File "/tmp/pip-build-k_28hio4/python-memcached/setup.py", line 4, in <module>
         import memcache
     Complete output from command python setup.py egg_info:
     Traceback (most recent call last):     

       File "<string>", line 20, in <module>     

       File "/tmp/pip-build-k_28hio4/python-memcached/setup.py", line 4, in <module>     

         import memcache     

     ----------------------------------------
     Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-k_28hio4/python-me
 mcached