如何在Python PEX文件中包含mpl_toolkits

时间:2014-12-21 17:27:05

标签: python matplotlib matplotlib-basemap

我想从我编写的导入mpl_toolkits.basemap的脚本中创建一个PEX文件。我尝试了很多方面,包括下载basemap .tar.gz,解压缩它,并将其放在我的工作目录中并尝试将其用作来源。

pex -r numpy -r matplotlib -s basemap-1.0.7 -s my_project -e my_project.my_project:main -o project.pex

运行生成的PEX文件会出现以下错误:

Traceback (most recent call last):
  File "/Users/connor/venv/scan_directory.pex/.bootstrap/_pex/pex.py", line 216, in execute
    working_set = self._env.activate()
  File "/Users/connor/venv/scan_directory.pex/.bootstrap/_pex/environment.py", line 123, in activate
    self._working_set = self._activate()
  File "/Users/connor/venv/scan_directory.pex/.bootstrap/_pex/environment.py", line 143, in _activate
    resolved = working_set.resolve(all_reqs, env=self)
  File "/Users/connor/venv/scan_directory.pex/.bootstrap/pkg_resources.py", line 639, in resolve
    raise DistributionNotFound(req)
DistributionNotFound: mpl-toolkits.basemap

我的脚本位于包目录中,其中包含setup.py文件和包含我的源代码和空__init__.py文件的单独目录,我认为这大部分都是正常的。这是我的setup.py脚本,

from setuptools import setup, find_packages
setup( name='my_project',
       version='0.1',
       install_requires=[ 'numpy',\
                          'matplotlib',\
                          'mpl_toolkits.basemap'],
       packages=find_packages() )

我应该在__init__.py添加语句吗?

0 个答案:

没有答案