为什么是设置.py显然成功地安装了我的软件包,但实际上没有安装一个依赖项?

2024-05-23 19:56:27 发布

您现在位置:Python中文网/ 问答频道 /正文

以下是说明问题的终端会话:

$ pip install scrappy --user
Requirement already satisfied (use --upgrade to upgrade): scrappy in /home/louist/Documents/Python/Scrappy
Downloading/unpacking guessit (from scrappy)
  Downloading guessit-0.5.3.tar.gz (45Kb): 45Kb downloaded
  Running setup.py egg_info for package guessit

Downloading/unpacking tvdb-api (from scrappy)
  Downloading tvdb_api-1.8.2.tar.gz
  Running setup.py egg_info for package tvdb-api

Downloading/unpacking hachoir-metadata (from scrappy)
  Downloading hachoir-metadata-1.3.3.tar.gz (52Kb): 52Kb downloaded
  Running setup.py egg_info for package hachoir-metadata
    Warning: unable to recompile dialog.ui to dialog_ui.py using pyuic4
    (use command "-c egg_info --egg-base pip-egg-info --disable-qt" to disable this warning)


Downloading/unpacking hachoir-core (from scrappy)
  Downloading hachoir-core-1.3.3.tar.gz (91Kb): 91Kb downloaded
  Running setup.py egg_info for package hachoir-core

Downloading/unpacking hachoir-parser (from scrappy)
  Downloading hachoir-parser-1.3.4.tar.gz (359Kb): 359Kb downloaded
  Running setup.py egg_info for package hachoir-parser

    warning: no files found matching 'metadata_csv.py'
Installing collected packages: guessit, tvdb-api, hachoir-metadata, hachoir-core, hachoir-parser
  Running setup.py install for guessit

  Running setup.py install for tvdb-api

  Running setup.py install for hachoir-metadata
    Warning: unable to recompile dialog.ui to dialog_ui.py using pyuic4
    (use command "-c install --single-version-externally-managed --record /tmp/pip-3OxvBD-record/install-record.txt --install-headers /home/louist/.virtualenvs/test/include/site/python2.7 --user --disable-qt" to disable this warning)

    changing mode of build/scripts-2.7/hachoir-metadata from 664 to 775
    changing mode of build/scripts-2.7/hachoir-metadata-gtk from 664 to 775
    changing mode of build/scripts-2.7/hachoir-metadata-qt from 664 to 775
    deleting hachoir_metadata.egg-info/requires.txt

    changing mode of /home/louist/.local/bin/hachoir-metadata to 775
    changing mode of /home/louist/.local/bin/hachoir-metadata-gtk to 775
    changing mode of /home/louist/.local/bin/hachoir-metadata-qt to 775
  Running setup.py install for hachoir-core

  Running setup.py install for hachoir-parser
    deleting hachoir_parser.egg-info/requires.txt

    warning: no files found matching 'metadata_csv.py'
Successfully installed guessit tvdb-api hachoir-metadata hachoir-core hachoir-parser
Cleaning up...
(test)louist@ltpc:~/Documents/Python/Scrappy$ python
Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import scrappy.core as scrappy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "scrappy/core.py", line 10, in <module>
    import guessit
ImportError: No module named guessit

简而言之,我做了以下事情:

  1. mkvirtualenv test启动一个virtualenv
  2. 尝试安装我正在通过pip install scrappy --user开发的包
  3. 启动python终端,然后尝试导入scrappy.core

这是我的设置.py文件:

^{pr2}$

有什么想法吗?在


Tags: installtofrompycoreinfoforegg
2条回答

默认情况下,新的virtualenv不包括安装在其外部的包(创建时没有 system-site-packages选项)。因此,testvirtualenv看不到安装到~/.local的包(由于 user选项)。在

创建带有系统站点包选项的virtualenv选项,或者在激活的virtualenv中安装时不使用用户。在

我也有类似的问题,那是发行版的问题 当我使用以下组件安装时-

sudo apt-get install python-scrapy

从命令行开始工作。在使用上述命令获取当前版本之前,请确保更新了存储库

相关问题 更多 >