2016-04-06 28 views
1
(.env) ➜ ~ easy_install ctypes 
Searching for ctypes 
Reading https://pypi.python.org/simple/ctypes/ 
No local packages or download links found for ctypes 
error: Could not find suitable distribution for Requirement.parse('ctypes') 


(.env) ➜ ~ pip install ctypes 
Collecting ctypes 
    Could not find a version that satisfies the requirement ctypes (from versions:) 
No matching distribution found for ctypes 

私はeasy_installまたはpipを使ってctypesをインストールしますが、それらはすべて失敗しました。MacでPython 2.7のctypesをインストールするには

ので、私はそれが再び失敗した

(.env) ➜ ctypes-1.0.2 sudo python setup.py build 
Password: 
running build 
running build_py 
running build_ext 
Configuring static FFI library: 
cd build/temp.macosx-10.11-intel-2.7/libffi && env CFLAGS='' '/Users/wyx/Downloads/ctypes-1.0.2/source/libffi/configure' 
env: /Users/wyx/Downloads/ctypes-1.0.2/source/libffi/configure: Permission denied 
Failed 

をインストールするctypes-1.0.2-AMD64.zipをダウンロードしてください。

(.env) ➜ ctypes-1.0.2 cd source/libffi 
(.env) ➜ libffi ll 
total 680 
[email protected] 1 wyx staff 1080 May 15 2007 LICENSE 
[email protected] 1 wyx staff 15851 May 15 2007 README 
[email protected] 1 wyx staff 3365 May 15 2007 aclocal.m4 
[email protected] 1 wyx staff 44911 May 15 2007 config.guess 
[email protected] 1 wyx staff 33113 May 15 2007 config.sub 
[email protected] 1 wyx staff 208082 May 15 2007 configure 
[email protected] 1 wyx staff 8716 May 15 2007 configure.ac 
[email protected] 1 wyx staff 4310 May 15 2007 fficonfig.h.in 
[email protected] 1 wyx staff 2125 May 15 2007 fficonfig.py.in 
[email protected] 4 wyx staff  136 Apr 7 00:30 include 
[email protected] 1 wyx staff 7416 May 15 2007 install-sh 
[email protected] 19 wyx staff  646 Apr 7 00:30 src 

それから私は、私は奇妙なプロンプトで再び失敗.But 777でのconfigureの許可を変更してみてください。それを解決するために私を助けたり、他のPythonのlibがありますすることができます代わりにより簡単にインストールすることができますのctypesのできる

(.env) ➜ ctypes-1.0.2 python setup.py build 
running build 
running build_py 
running build_ext 
Configuring static FFI library: 
cd build/temp.macosx-10.11-intel-2.7/libffi && env CFLAGS='' '/Users/wyx/Downloads/ctypes-1.0.2/source/libffi/configure' 
env: /Users/wyx/Downloads/ctypes-1.0.2/source/libffi/configure: No such file or directory 
Failed 
(.env) ➜ ctypes-1.0.2 cd source/libffi 
(.env) ➜ libffi ll 
total 680 
[email protected] 1 wyx staff 1080 May 15 2007 LICENSE 
[email protected] 1 wyx staff 15851 May 15 2007 README 
[email protected] 1 wyx staff 3365 May 15 2007 aclocal.m4 
[email protected] 1 wyx staff 44911 May 15 2007 config.guess 
[email protected] 1 wyx staff 33113 May 15 2007 config.sub 
[email protected] 1 wyx staff 208082 May 15 2007 configure 
[email protected] 1 wyx staff 8716 May 15 2007 configure.ac 
[email protected] 1 wyx staff 4310 May 15 2007 fficonfig.h.in 
[email protected] 1 wyx staff 2125 May 15 2007 fficonfig.py.in 
[email protected] 4 wyx staff  136 Apr 7 00:30 include 
[email protected] 1 wyx staff 7416 May 15 2007 install-sh 
[email protected] 19 wyx staff  646 Apr 7 00:30 src 

+0

ctypesは標準モジュールです。インストールする必要はありません。しかし、私はMacを使わない、私はLinuxを使う。 –

+0

Macでも同じです。 –

答えて

3

Python 2.5 ctypesはPythonの標準ライブラリの一部です。そのままインポートしてください:

import ctypes 

何もインストールする必要はありません。

+0

ありがとう、あなたは私の問題を解決します。私が学ぶコースはPython 2.4を使用しています。それ以前はこのライブラリを使用しませんでした。 – wyx

関連する問題