我正在尝试研究用于python包/虚拟环境管理的conda。但是,我似乎无法构建自己的conda包。有人可以帮我构建一个最小的工作示例吗?
首先是一些目录结构:
- src/
|- foo1.py
|- foo2.py
- conda-build/
|- meta.yaml
- setup.py
运行python setup.py install
使用pip安装软件包。现在,如果我尝试cd到conda-build目录并运行conda build .
,我得到以下输出
Removing old build directory
Removing old work directory
BUILD START: example_pkg-0.5.1-abc
Fetching package metadata: ......
Solving package specifications: .
The following NEW packages will be INSTALLED:
pip: 6.1.1-py34_0
python: 3.4.3-0
setuptools: 15.0-py34_0
Linking packages ...
[ COMPLETE ]|##################################################| 100%
Removing old work directory
Copying C:\some\path\ to C:\Anaconda3\conda-bld\work
Package: example_pkg-0.5.1-abc
source tree in: C:\Anaconda3\conda-bld\work
number of files: 0
Fixing permissions
Fixing permissions
BUILD END: example_pkg-0.5.1-abc
Nothing to test for: example_pkg-0.5.1-abc
# If you want to upload this package to binstar.org later, type:
#
# $ binstar upload C:\Anaconda3\conda-bld\win-64\example_pkg-0.5.1- abc.tar.bz2
#
# To have conda build upload to binstar automatically, use
# $ conda config --set binstar_upload yes
我确实可以在目录C:\ Anaconda3 \ conda-bld \ win-64中找到该包,但该包似乎不包含任何文件。我可以使用conda install --use-local .\example_pkg-0.5.1-abc.tar.bz2
安装软件包,然后由conda list
列出,但是我无法在Python中导入它。这是我的meta.yaml:
package:
name: example_pkg
version: "0.5.1"
source:
path: ../src
build:
number: 1
string: abc
script: python setup.py install
requirements:
build:
- python
run:
- python
非常感谢任何帮助! :)
答案 0 :(得分:1)
看起来像issue,其中build / script在Windows上不起作用。在PR合并之前,您应该只使用
创建bld.bat
python setup.py install
if errorlevel 1 exit 1
并将其放入conda配方中。