使用setup.py自定义python软件包安装

时间:2020-10-14 15:55:29

标签: python installation setuptools setup.py

我想安装一个python软件包(用cython编写的第三方软件包,用于一些数值计算)。 我以前的经验(成功的经验)是,我只需要执行以下命令:

python setup.py install --prefix="/destination/path/"

然后,我希望有一个附加文件夹作为/ destination / path / package 所以,我可以做

export PYTHONPATH=$PYTHONPATH:/destination/path/

因此,我终于可以正常地使用python脚本导入软件包了。

但是,似乎setup.py(我正在使用anaconda python3.7)的默认行为已更改。当我使用相同的(第一个)命令时,遇到以下错误:

Checking .pth file support in /destination/path//lib/python3.7/site-packages/

/path/to/python -E -c pass

TEST FAILED: /destination/path/lib/python3.7/site-packages/ does NOT support .pth files
error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/destination/path/lib/python3.7/site-packages/

有人可以向我解释发生了什么,如何解决该错误?

非常感谢您。

最好

格雷格

0 个答案:

没有答案