Python 循环本地模块

Python wheeling local module

我正在编写一个需要 pygame 的项目。

我已经按照 pygame wiki 中的说明在 python 中安装了 pygame。

pip install hg+http://bitbucket.org/pygame/pygame

我想将 pygame 添加到我正在创建的 wheel 目录中。我正在尝试使用命令

来执行此操作
pip wheel --wheel-dir=wheels/linux64 pygame

我尝试添加 --no-index--find-links=https://bitbucket.org/pygame/pygame--allow-unverified pygame--allow-external pygame 选项。

输出总是类似于找不到满足要求的包 pygame。

Downloading/unpacking pygame
  Could not find any downloads that satisfy the requirement pygame
  Some externally hosted files were ignored (use --allow-external pygame to allow).
Cleaning up...
No distributions at all found for pygame
Storing debug log for failure in /home/eric/.pip/pip.log

如何才能 wheel 我的本地版本 pygame 并将其添加到我的 wheel 目录?

您需要将 pip 指向源目录才能制作轮子。 例如:

$ hg clone https://bitbucket.org/pygame/pygame
...
...
$ pip wheel pygame/
Processing ./pygame
Building wheels for collected packages: pygame
  Running setup.py bdist_wheel for pygame
  Stored in directory: /home/vagrant/wheelhouse
Successfully built pygame
(test)vagrant@vagrant-ubuntu-trusty-64:~$ ll /home/vagrant/wheelhouse
total 3264
drwxrwxr-x 2 vagrant vagrant    4096 Sep  6 01:24 ./
drwxr-xr-x 7 vagrant vagrant    4096 Sep  6 01:24 ../
-rw-rw-r-- 1 vagrant vagrant 3333795 Sep  6 01:24 pygame-1.9.2a0-cp27-none-linux_x86_64.whl

您无法从已安装的模块创建轮子,因为它缺少安装说明部分 (setup.py)。有关详细信息,请查看 wheel's usage instructions.