我正在使用venv從PyPI安裝elpy
軟件包的新版本,而不是在根環境中提供的版本。從pip
查詢,我看到下面的版本elpy
:Enthought python軟件包導入優先
~/python/standalone $ pip show elpy
---
Name: elpy
Version: 1.4.2
Location: /home/wdkrnls/python/env/local/lib/python2.7/site-packages
Requires: flake8
然而,使用解釋給我的根環境的版本。
In [4]: import elpy
In [5]: elpy.__version__
Out[5]: '1.3.0'
In [6]: ?elpy
Type: module
String Form:<module 'elpy' from '/home/ipython/Enthought2/lib/python2.7/site-packages/elpy/__init__.pyc'>
File: /home/ipython/Enthought/lib/python2.7/site-packages/elpy/__init__.py
Docstring:
The Emacs Lisp Python Environment.
爲什麼會發生這種情況,我該如何解決?
我sys.path
是亂了,我不知道如何把它清理乾淨(我已經升級在過去的冠層分佈),但在這裏它是:
['',
'/home/wdkrnls/python/env/local/bin',
'/home/wdkrnls/python/env/local/lib/python2.7/site-packages/jediepcserver-0.0.0-py2.7.egg',
'/home/wdkrnls/python/env/local/lib/python2.7/site-packages/epc-0.0.5-py2.7.egg',
'/home/wdkrnls/python/env/local/lib/python2.7/site-packages/sexpdata-0.0.3-py2.7.egg',
'/home/ipython/Enthought2/lib/python2.7/site-packages/PyCifRW-3.3-py2.7-linux-x86_64.egg',
'/home/ipython/Enthought2/lib/python2.7/site-packages/graphtool-0.5.2-py2.7.egg',
'/home/ipython/Enthought2/lib/python2.7/site-packages',
'/home/wdkrnls/python/env/local/lib/python2.7/site-packages/argparse-1.2.1-py2.7.egg',
'/share/apps/python/Canopy/appdata/canopy-1.3.0.1715.rh5-x86_64/lib/python2.7/site-packages',
'/home/ipython/Enthought/Canopy_64bit/User/lib/python2.7/site-packages',
'/home/wdkrnls/python/packages',
'/home/wdkrnls/python/standalone',
'/share/apps/python/Canopy/appdata/canopy-1.3.0.1715.rh5-x86_64/lib/python27.zip',
'/share/apps/python/Canopy/appdata/canopy-1.3.0.1715.rh5-x86_64/lib/python2.7',
'/share/apps/python/Canopy/appdata/canopy-1.3.0.1715.rh5-x86_64/lib/python2.7/plat-linux2',
'/share/apps/python/Canopy/appdata/canopy-1.3.0.1715.rh5-x86_64/lib/python2.7/lib-tk',
'/share/apps/python/Canopy/appdata/canopy-1.3.0.1715.rh5-x86_64/lib/python2.7/lib-old',
'/share/apps/python/Canopy/appdata/canopy-1.3.0.1715.rh5-x86_64/lib/python2.7/lib-dynload',
'/home/wdkrnls/python/env/local/lib/python2.7/site-packages',
'/home/ipython/Enthought2/lib/python2.7/site-packages/PIL',
'/home/ipython/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/PIL',
'/share/apps/python/Canopy/appdata/canopy-1.3.0.1715.rh5-x86_64/lib/python2.7/site-packages/IPython/extensions',
'/home/wdkrnls/python/packages',
'/home/wdkrnls/python/standalone']
我應該如何去維護sys.path
? Canopy發行版需要所有這些.egg文件嗎?
的〔蟒路徑和進口順序]可能重複(http://stackoverflow.com/questions/9586630/python-paths-and-import-order) – aruisdante
嗯......在我的本地站點之前檢查根站點包。 – wdkrnls
在你的.bashrc中導出路徑 –