0
是否有可能升級安裝apt-get的軟件包,因此位於/ usr/lib /中,如果這樣的軟件包在pypi中有更新的版本,但不在標準的Ubuntu軟件倉庫中,如apt看到的那樣?在/ usr/lib中升級apt安裝的Python軟件包?
我想這是危險的,因爲它可能會打破依賴關係,但它只是爲了知道。
是否有可能升級安裝apt-get的軟件包,因此位於/ usr/lib /中,如果這樣的軟件包在pypi中有更新的版本,但不在標準的Ubuntu軟件倉庫中,如apt看到的那樣?在/ usr/lib中升級apt安裝的Python軟件包?
我想這是危險的,因爲它可能會打破依賴關係,但它只是爲了知道。
是的。
卸載Flask
$ sudo apt-get remove python-flask
我沒有它:
$ python
Python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import flask
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named flask
我安裝
$ sudo apt-get install python-flask
$ python
Python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import flask
>>> flask.__version__
'0.12'
仔細檢查:
$ pip list -o | grep Flask
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
Flask (0.12.1) - Latest: 0.12.2 [wheel]
升級:
$ sudo pip install --upgrade Flask
...
Successfully installed Flask-0.12.2 Jinja2-2.9.6 MarkupSafe-1.0 Werkzeug-0.12.2 click-6.7 itsdangerous-0.24
$ python
Python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import flask
>>> flask.__version__
'0.12.2'
我看到我有點子檢查的問題,但是:
$ pip list -o | grep Flask
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
Flask (0.12.1) - Latest: 0.12.2 [wheel]
所以我必須有一些鏈接什麼的壞了,但這個問題還活着,即使我使用apt-get remove
。總之,我能夠導入更新版本的Flask,這是你所需要的,我猜。
編輯
確定,問題是pip
在不同的位置,然後apt-get
安裝Flask
。這是PIP輸出:
>>> flask.__file__
'/usr/local/lib/python2.7/dist-packages/flask/__init__.pyc'
這是易於得到的:
>>> flask.__file__
'/usr/lib/python2.7/dist-packages/flask/__init__.pyc'
Here是如何讓pip
安裝你在不同的目錄包裝的說明。但是,我沒有測試過它。
向google索要'python virtualenv' – gboffi
這樣可以節省中斷依賴的風險。 – gonczor