简体   繁体   English

pyenv + virtualenv找不到洪水

[英]pyenv + virtualenv not finding deluge

I'm trying to use deluge from a virtualenv build with PYENV. 我正在尝试使用带有PYENV的virtualenv构建中的洪水。
For this purpose, I used pyenv to build a python 2.7.9. 为此,我使用pyenv来构建python 2.7.9。
I've set pyenv global to 2.7.9 and then installed the deluge package with: 我已经将pyenv global设置为2.7.9,然后使用以下命令安装了deluge软件包:

apt-get install deluged deluge-console apt-get install deluged deluge-console

Everything went fine, but when I try to do : 一切都很好,但是当我尝试这样做时:

import deluge 进口洪水

it gives ImportError. 它给出了ImportError。

A pip freeze from inside 2.7.9 enviroment correctly display the deluge package: 从2.7.9环境内部冻结的点正确显示了洪水包:

spadazz@Deluger:~/.pyenv/versions/2.7.9$ pip freeze
apt-xapian-index==0.44
chardet==2.0.1
command-not-found==0.2.44
deluge==1.3.11

Doing a check with dpkg -l on ubuntu installed packages for deluge, I can see that deluge python package can be found at /usr/lib/python2.7/dist-packages, so adding this path to python sys.path, allows me to manually import the package. 在ubuntu安装的软件包上使用dpkg -l进行了检查以检查是否有大量的deluge,我可以在/usr/lib/python2.7/dist-packages中找到deluge python软件包,因此将该路径添加到python sys.path中可以使我手动导入软件包。

My problem is this can't be manual and the deluge package is not requested by a program of mine, but from flexget package, that runs smoothly in this configuration. 我的问题是,这不能是手动的,并且我的程序不是请求deluge程序包,而是从flexget程序包请求,该程序在此配置下可以平稳运行。

I'm not experienced in pyenv and I can't find a simple way to setup a PYTHON_PATH under a pyenv virtualenv, or any other workaround that allows me to call deluge package in system's python under the virtualenv. 我没有pyenv的经验,也找不到在pyenv virtualenv下设置PYTHON_PATH的简单方法,也无法找到允许我在virtualenv下在系统的python中调用deluge包的任何其他解决方法。

Any suggestions ? 有什么建议么 ?

TIA Enrico TIA恩里科

  • Running from Ubuntu Server 12.04 从Ubuntu Server 12.04运行
  • pyenv 20150326-483-g10d5d9a pyenv 20150326-483-g10d5d9a

The Python module deluge is installed to your system python when you apt-get install deluged I belive (I could be mistaken though). 当您apt-get install deluged时,Python模块的deluge已安装到您的系统python中(尽管我可能会误会)。

Kinda sucks that this Python module deluge is not available via pip, but you should be able to install it into your virtualenv with the following: Kinda很遗憾,该Python模块deluge无法通过pip获得,但是您应该可以使用以下命令将其安装到virtualenv中:

First off, have your virtualenv of choice activated, then run 首先,激活您选择的virtualenv,然后运行

mkdir ~/my_lovely_directory && cd ~/my_lovely_directory
git clone git://deluge-torrent.org/deluge.git
cd deluge
git checkout -b 1.3-stable origin/1.3-stable
python setup.py build
python setup.py install

Note: At this time of writing the Python module deluge is at version 1.3.13, if it is ~1.4 or higher at time of reading you might want to checkout different branch above, see list of branches with git branch -a . 注意:在编写本文时,Python模块deluge的版本为1.3.13,如果在阅读时为〜1.4或更高版本,则可能需要检出上面的其他分支,请参阅带有git branch -a的分支列表。

You should now see a package called something like this deluge (1.3.13.dev0) when running pip list in your selected virtualenv. 现在,当在选定的virtualenv中运行pip list时,您应该会看到一个名为deluge (1.3.13.dev0)类的软件包。

If everything looks good you can clean up a bit with 如果一切看起来不错,您可以用

cd ~/ && rm -rf ~/my_lovely_directory

Sources: 资料来源:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM