在Mac上安装pyquery
我先是用pypm安装的,结果和用pip的体验基本一样(我把输出结果复制粘贴在下面了)。安装提示说已经安装成功了,而且在pip和pypm的安装列表里都能看到pyquery。但是当我进入Python解释器时,明显pyquery并没有安装 :o
我到底哪里出错了呢?
arnab:pybikes arnab$ pip list
cssselect (0.8)
lxml (3.2.3)
pip (1.4.1)
PyBikes (0.2dev)
pypm (1.4.0)
pythonselect (1.3)
requests (2.0.0)
setuptools (1.1.4)
virtualenv (1.10.1)
wsgiref (0.1.2)
arnab:pybikes arnab$ pip install pyquery
Downloading/unpacking pyquery
Downloading pyquery-1.2.8.zip (42kB): 42kB downloaded
Running setup.py egg_info for package pyquery
no previously-included directories found matching 'docs/_build'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '__pycache__' found anywhere in distribution
Requirement already satisfied (use --upgrade to upgrade): lxml>=2.1 in /Users/arnab/Library/Python/2.7/lib/python/site-packages (from pyquery)
Requirement already satisfied (use --upgrade to upgrade): cssselect in /Users/arnab/Library/Python/2.7/lib/python/site-packages (from pyquery)
Installing collected packages: pyquery
Running setup.py install for pyquery
no previously-included directories found matching 'docs/_build'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '__pycache__' found anywhere in distribution
Successfully installed pyquery
Cleaning up...
arnab:pybikes arnab$ pip list
cssselect (0.8)
lxml (3.2.3)
pip (1.4.1)
PyBikes (0.2dev)
pypm (1.4.0)
pyquery (1.2.8)
pythonselect (1.3)
requests (2.0.0)
setuptools (1.1.4)
virtualenv (1.10.1)
wsgiref (0.1.2)
arnab:pybikes arnab$ python
Python 2.7.3 (480845e6b1dd, Jul 31 2013, 10:58:28)
[PyPy 2.1.0 with GCC 4.2.1 Compatible Clang Compiler] on darwin
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``the future has just begun''
>>>> import pyquery
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pyquery
>>>>
1 个回答
1
对于Mac用户,我是通过终端命令行使用easy_install的。首先,你需要从这里安装setuptools:https://pypi.python.org/pypi/setuptools,在页面底部你可以找到Mac的下载链接。下载后解压文件,然后运行ez_setup来安装它。
我测试过,pyquery可以直接安装。 我用的代码是:sudo easy_install pyquery
,然后输入我的密码,重启Python后,在Python控制台输入import pyquery
,结果是可以正常使用的。