我创建了一个脚本,该脚本创建了一个虚拟环境,在其中安装了pybuilder,然后使用pybuilder命令安装了一些依赖项。
但是,似乎无法正确执行pybuilder命令。
这是我的bash脚本:
#! /bin/bash
projects_name=$1
cd /Users/my_name/vms/
virtualenv -p python3 $projects_name
source $projects_name/bin/activate
echo virtual environment has been activated
pip install --pre pybuilder
pip install pybuilder
cd /Users/my_name/PycharmProjects/$projects_name
pip install --upgrade pip
pyb intall_dependencies
这是输出:
XXXXXXXXX:Desktop$ ./create_virtual_env.sh eda
Running virtualenv with interpreter /usr/local/bin/python3
Using base prefix '/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7'
New python executable in /Users/my_name/vms/eda/bin/python3.7
Also creating executable in /Users/my_name/vms/eda/bin/python
Installing setuptools, pip, wheel...
done.
virtual environment has been activated
Collecting pybuilder
Using cached https://files.pythonhosted.org/packages/ee/68/642708cd4809e395fcd3b8067c1c24f8d091e9d1b338cd4f6cc180906326/pybuilder-0.12.0.dev20190116131423-py3-none-any.whl
Collecting tailer~=0.4 (from pybuilder)
Collecting pip~=9.0 (from pybuilder)
Using cached https://files.pythonhosted.org/packages/ac/95/a05b56bb975efa78d3557efa36acaf9cf5d2fd0ee0062060493687432e03/pip-9.0.3-py2.py3-none-any.whl
Collecting tblib (from pybuilder)
Using cached https://files.pythonhosted.org/packages/64/b5/ebb1af4d843047ccd7292b92f5e5f8643153e8b95d14508d9fe3b35f7004/tblib-1.4.0-py2.py3-none-any.whl
Requirement already satisfied: wheel~=0.31 in ./eda/lib/python3.7/site-packages (from pybuilder) (0.33.4)
Collecting setuptools~=39.0 (from pybuilder)
Using cached https://files.pythonhosted.org/packages/7f/e1/820d941153923aac1d49d7fc37e17b6e73bfbd2904959fffbad77900cf92/setuptools-39.2.0-py2.py3-none-any.whl
Installing collected packages: tailer, pip, tblib, setuptools, pybuilder
Found existing installation: pip 19.2.1
Uninstalling pip-19.2.1:
Successfully uninstalled pip-19.2.1
Found existing installation: setuptools 41.0.1
Uninstalling setuptools-41.0.1:
Successfully uninstalled setuptools-41.0.1
Successfully installed pip-9.0.3 pybuilder-0.12.0.dev20190116131423 setuptools-39.2.0 tailer-0.4.1 tblib-1.4.0
Requirement already satisfied: pybuilder in ./eda/lib/python3.7/site-packages
Requirement already satisfied: tblib in ./eda/lib/python3.7/site-packages (from pybuilder)
Requirement already satisfied: setuptools~=39.0 in ./eda/lib/python3.7/site-packages (from pybuilder)
Requirement already satisfied: tailer~=0.4 in ./eda/lib/python3.7/site-packages (from pybuilder)
Requirement already satisfied: pip~=9.0 in ./eda/lib/python3.7/site-packages (from pybuilder)
Requirement already satisfied: wheel~=0.31 in ./eda/lib/python3.7/site-packages (from pybuilder)
You are using pip version 9.0.3, however version 19.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Cache entry deserialization failed, entry ignored
Collecting pip
Using cached https://files.pythonhosted.org/packages/62/ca/94d32a6516ed197a491d17d46595ce58a83cbb2fca280414e57cd86b84dc/pip-19.2.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 9.0.3
Uninstalling pip-9.0.3:
Successfully uninstalled pip-9.0.3
Successfully installed pip-19.2.1
PyBuilder version 0.12.0.dev20190116131423
Build started at 2019-08-08 08:02:27
------------------------------------------------------------
------------------------------------------------------------
BUILD FAILED - No such task intall_dependencies
------------------------------------------------------------
Build finished at 2019-08-08 08:02:27
Build took 0 seconds (3 ms)
但是,当我随后手动激活环境并运行pybuilder命令时:
XXXXXXXX:Desktop$ cd /Users/my_name/vms/
XXXXXXXX:vms$ source eda/bin/activate
(eda) XXXXXXXX:vms$ cd /Users/my_name/PycharmProjects/eda/
(eda) XXXXXXXX:eda$ pyb install_dependencies
PyBuilder version 0.12.0.dev20190116131423
Build started at 2019-08-08 08:04:20
------------------------------------------------------------
[INFO] Building project name version 1.0.dev0
[INFO] Executing build in /Users/my_name/PycharmProjects/eda
[INFO] Going to execute task install_dependencies
[INFO] Installing all dependencies
[INFO] Processing batch dependency 'cufflinks'
[INFO] Processing batch dependency 'herepy'
[INFO] Processing batch dependency 'matplotlib'
[INFO] Processing batch dependency 'numpy'
[INFO] Processing batch dependency 'pandas'
[INFO] Processing batch dependency 'plotly'
[INFO] Processing batch dependency 'plotly_express'
[INFO] Processing batch dependency 'scipy'
[INFO] Processing batch dependency 'seaborn'
[INFO] Processing batch dependency 'xlrd'
------------------------------------------------------------
BUILD SUCCESSFUL
------------------------------------------------------------
Build Summary
Project: project name
Version: 1.0.dev0
Base directory: /Users/my_name/PycharmProjects/eda
Environments:
Tasks: install_dependencies [45197 ms]
Build finished at 2019-08-08 08:05:05
Build took 45 seconds (45206 ms)
这意味着只有最后一个命令在bash脚本中不起作用。
答案 0 :(得分:0)
我的脚本中有错字。该问题可以关闭/删除。