为什么pip试图安装ctypes?

时间:2013-02-03 20:55:03

标签: python pip distutils

我尝试创建一个简单的小包并将其上传到PyPi。当我尝试安装它时,pip尝试下载并安装ctypes(并且在编译时失败了..):

(dev) C:\work\dev>pip install --upgrade dosbox-screen
Downloading/unpacking dosbox-screen
  Running setup.py egg_info for package dosbox-screen
Downloading/unpacking ctypes (from dosbox-screen)
  Running setup.py egg_info for package ctypes
    warning: no files found matching 'MANIFEST'
    warning: no files found matching 'NEWS.txt'
    warning: no files found matching 'ctypes\.CTYPES_DEVEL'
Downloading/unpacking colorama (from dosbox-screen)
  Running setup.py egg_info for package colorama
Installing collected packages: dosbox-screen, ctypes, colorama
  Running setup.py install for dosbox-screen
  Running setup.py install for ctypes
    building '_ctypes' extension
    error: Unable to find vcvarsall.bat
    Complete output from command C:\work\dev\Scripts\python.exe -..

我在虚拟环境中使用Python 2.6.6,因此任何ctypes要求都应该已经满足:

(dev) C:\work\dev>python
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> ctypes.__file__
'c:\\python26\\Lib\\ctypes\\__init__.pyc'

我的setup.py文件的第一个版本将其列为要求,但当前版本不是:

setup(
    name='dosbox-screen',
    version='0.0.3',
    requires=['colorama'],
    install_requires=['colorama'],
    ...

我做错了什么?

1 个答案:

答案 0 :(得分:1)

您上传新版本了吗?看起来pip正在安装您提到的旧版本(带有ctypes dep)。尝试传递-v参数以获得更详细的输出。