我使用pip requirements file来维护我的项目的依赖项列表。
我现在发现自己必须使用pip install --install-option='some-setup.py.option'
安装库,但 pip freeze
没有将这些选项记录在我保存在项目的requirements.txt
中的输出中。这会导致问题,因为新机器上的一个简单pip install -r requirements.txt
会安装所有依赖项,而没有为这个库提供所需的参数,而且我已经失去了简单的往返操作。
所以,我的两部分问题是:
pip freeze
的往返特性,转而手动维护需求文件。我已经检查了documentation,但是看不到任何有帮助的东西。后面有不必要但可能有趣的细节
我想安装pymongo和without building the C extension,这样我就可以在基于eventlet的应用程序中异步使用它了。
根据需要安装并构建requirements.txt:
(test)day@office:~/test$ pip install pymongo --install-option='--no_ext'
Downloading/unpacking pymongo
Downloading pymongo-2.1.1.tar.gz (199Kb): 199Kb downloaded
Running setup.py egg_info for package pymongo
Installing collected packages: pymongo
Running setup.py install for pymongo
Successfully installed pymongo
Cleaning up...
(test)day@office:~/test$ pip freeze > requirements.txt
(test)day@office:~/test$ cat requirements.txt
bottle==0.10.7
distribute==0.6.10
eventlet==0.9.16
greenlet==0.3.3
lxml==2.3.3
pymongo==2.1.1
simplejson==2.3.2
wsgiref==0.1.2
在new virtualenv中,尝试从requirements.txt
安装相同的项目。pip为pymongo :(
构建C扩展
(test2)day@office:~/test2$ pip install -r requirements.txt
...
Downloading/unpacking pymongo==2.1.1 (from -r requirements.txt (line 6))
Downloading pymongo-2.1.1.tar.gz (199Kb): 199Kb downloaded
Running setup.py egg_info for package pymongo
Installing collected packages: pymongo
Running setup.py install for pymongo
building 'bson._cbson' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/include/python2.6 -c bson/_cbsonmodule.c -o build/temp.linux-i686-2.6/bson/_cbsonmodule.o
...
Successfully installed pymongo
Cleaning up...
更新 Issue 271在2011年4月针对pip开放,要求能够在requirements.txt中指定每行--install-option
。如果你有同样的问题,请为这个问题投票。
https://stackoverflow.com/questions/8874638
复制相似问题