我有很多的系統已經打亂開發商「下,他們在互聯網上找到的方向」工作。這是非常常見的,你pip
和你python
不看相同的路徑/ site-packages中。出於這個原因,當我遇到奇怪我開始做這個:
$ python -c 'import sys; print(sys.path)'
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages']
$ pip --version
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
這是一個快樂的系統。
下面是一個不高興系統。 (或者至少是一個幸福無知系統,使他人快樂。)
$ pip --version
pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)
$ python -c 'import sys; print(sys.path)'
['', '/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/site-packages']
$ which pip pip2 pip3
/usr/local/bin/pip
/usr/local/bin/pip3
這是不高興因爲pip
是使用/usr/local/lib/python3.6/site-packages
而python
是(python3.6和)使用(python2.7和) /usr/local/lib/python2.7/site-packages
當我要確保我安裝要求,以權蟒蛇,我這樣做:
$ which -a python python2 python3
/usr/local/bin/python
/usr/bin/python
/usr/local/bin/python2
/usr/local/bin/python3
$ /usr/bin/python -m pip install -r requirements.txt
你聽說過,「如果沒壞,不要試圖去解決它。」的是,DevOps的版本是,「如果你沒有打破它,你可以解決它,不要試圖去解決它。」
您是否嘗試過使用'--no-index',所以它甚至沒有看PyPI? –
你已經刪除了錯誤信息。它通常在底部附近。 – bukzor
您可以使用文件路徑而不是軟件包名稱,這意味着您必須更改requirements.txt文件,但保持pip install命令相同。 – asafge