我正在遵循https://conda.io/docs/user-guide/tutorials/build-pkgs.html来构建我的第一个(私有)Python软件包。我没有将其托管在PyPi上,我也不想这样做。我发现我遇到的问题与链接教程中的演示相同。即,我按照步骤操作,创建meta.yaml
和build.bat
(仅将.sh
跳过为Im Windows),使用Anaconda提示符进入目录,然后运行conda-build .
。错误消息如下:
(base) C:\Users\jvanzundert\conda-bld\pyinstrument_1535453523573\test_tmp>call "C:\ProgramData\Anaconda3\Scripts\activate.bat" "C:\Users\jvanzundert\conda-bld\pyinstrument_1535453523573\_test_env"
(C:\Users\jvanzundert\conda-bld\pyinstrument_1535453523573\_test_env) C:\Users\jvanzundert\conda-bld\pyinstrument_1535453523573\test_tmp>IF 0 NEQ 0 exit 1
(C:\Users\jvanzundert\conda-bld\pyinstrument_1535453523573\_test_env) C:\Users\jvanzundert\conda-bld\pyinstrument_1535453523573\test_tmp>"C:\Users\jvanzundert\conda-bld\pyinstrument_1535453523573\_test_env\python.exe" -s "C:\Users\jvanzundert\conda-bld\pyinstrument_1535453523573\test_tmp\run_test.py"
import: 'pyinstrument'
Traceback (most recent call last):
File "C:\Users\jvanzundert\conda-bld\pyinstrument_1535453523573\test_tmp\run_test.py", line 2, in <module>
import pyinstrument
ModuleNotFoundError: No module named 'pyinstrument'
(C:\Users\jvanzundert\conda-bld\pyinstrument_1535453523573\_test_env) C:\Users\jvanzundert\conda-bld\pyinstrument_1535453523573\test_tmp>IF 1 NEQ 0 exit 1
Tests failed for pyinstrument-0.13.1-py36_0.tar.bz2 - moving package to C:\Users\jvanzundert\conda-bld\broken
WARNING:conda_build.build:Tests failed for pyinstrument-0.13.1-py36_0.tar.bz2 - moving package to C:\Users\jvanzundert\conda-bld\broken
removing: pyinstrument-0.13.1-py36_0.tar.bz2
TESTS FAILED: pyinstrument-0.13.1-py36_0.tar.bz2
这是我的设置还是教程问题?
对于我自己的程序包,我认为我的布局应该是这样的(请注意,我对Python相对较新)
- <package name>
+ <package name>
+ __init__.py (empty)
+ <package name>.py
+ meta.yaml
+ setup.py (only an empty print statement)
+ bld.bat
meta.yaml文件的内容:
package:
name: <package name>
version: "0.0.1"
requirements:
host:
- python
run:
- python
test:
imports:
- <package name>
source:
path: $RECIPE_DIR\..
但这不起作用,在类似pyinstrument
示例的测试中也失败。