简体   繁体   中英

Enthought python not recognising system modules

I have installed the Enthought Python Distribution (ie python 2.7) on a Ubuntu 12.04 virtual machine and it would be very useful if it could recognise modules imported via the synaptic package manager. Currently, these are only recognised by the system-provided python installation (quite understandably). Since both pythons are 2.7, is it possible to make my EPD installation recognise the system modules? Thanks.

No, using synaptic-installed modules with EPD is not supported. Of course, you can try adding specific packages to your PYTHONPATH, but this is likely to create conflicts, especially for modules containing C-extensions that may be linked against a slightly different version of Python.

Currently, the recommended way to install python packages in EPD is with the enpkg tool. Try enpkg -s <packagename> to see if your desired package is in Enthought's repository. If you haven't already, you should upgrade enpkg itself by running enpkg enstaller and enter your EPD credentials by running enpkg --userpass . Then you should be able to install supported packages with enpkg <packagename> (Using enpkg to update EPD packages) .

If the package you're looking for isn't in Enthought's repository, you can install pip with enpkg pip and install packages in EPD with that tool.

Alternately, you can download the source for your desired package and install it with python setup.py install , assuming the package has a setup.py.

Note: if you install a package into EPD without using enpkg, you should make sure to remove the EPD version of the package first if it exists ( enpkg --remove <packagename> ). If you later choose to install the package with enpkg, you should first remove the version you installed with an alternate method (Using non-EPD package installers such as pip) .

There is also an upcoming GUI package manager from Enthought, currently in Beta.

Had the same problem.Enthought distribution uses completely different python paths and library prefix than your run of the mill system distribution. So if you use pip, pip will install on your system path, not your EPD path. Solution:

1) get your EPD prefix with: enpkg --path

2) write it down somewhere

3) if you pip install then type:

pip install --install-option="--prefix=$PREFIX_PATH" package_name

as written by Ian Bicking on Install a Python package into a different directory using pip? .

The previous answer might be obsolete. On version 4.6.3 use enpkg --env to get the prefix

$ enpkg --version
enstaller version: 4.6.3

$ enpkg --env

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM