找不到麻线命令(circleci)
twine command not found (circleci)
当新标签被推送到 GitHub 时,我正在使用 circleci 自动将我的 python 包部署到 PyPi。我一直在关注这个 tutorial
我的工作流程因错误 home/circleci/project/twitter_sentiment/bin/python: No module named twine
而失败
我已尝试确保在调用 twine 命令之前安装了 twine。我还尝试用 python -m twine
调用 twine 命令,据我了解,似乎 twine 没有添加到容器的路径中 - 这会导致 command not found
错误。
我该如何解决这个错误?
config.yml 文件
version: 2
jobs:
build:
docker:
- image: circleci/python:3.6
working_directory: ~/twitter-sentiment
steps:
- checkout
- run:
name: install dependencies
command: |
python3 -m venv twitter_sentiment
. twitter_sentiment/bin/activate
pip install -r requirements.txt
- save_cache:
paths:
- ./twitter_sentiment
key: v1-dependencies-{{ checksum "setup.py" }}
runLibraryTest:
docker:
- image: circleci/python:3.6
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "setup.py" }}
- run:
name: run twitter_sentiment tests
command: |
python3 -m venv twitter_sentiment
. twitter_sentiment/bin/activate
pip install -r requirements.txt
cd test/
python3 -m unittest test_twitterSentiment
- save_cache:
paths:
- ./twitter_sentiment
key: v1-dependencies-{{ checksum "setup.py" }}
- store_artifacts:
path: test-reports
destination: test-reports
deploy:
docker:
- image: circleci/python:3.6
steps:
- checkout
- restore_cache:
key: v1-dependencies-{{ checksum "setup.py" }}
- run:
name: verify git tag vs version
command: |
python3 -m venv twitter_sentiment
. twitter_sentiment/bin/activate
pip install -r requirements.txt
python3 setup.py verify
- run:
name: create package files
command: |
python3 setup.py sdist bdist_wheel
- run:
name: create .pypirc file
command: |
echo -e "[pypi]" >> .pypirc
echo -e "repository = https://pypi.org/legacy/"
echo -e "username = TeddyCr" >> .pypirc
echo -e " = $PYPI_PASSWORD" >> .pypirc
- run:
name: upload package to pypi server
command: |
python3 -m venv twitter_sentiment
. twitter_sentiment/bin/activate
pip install --user --upgrade twine
python -m twine upload dist/*
- save_cache:
paths:
- ./twitter_sentiment
key: v1-dependencies-{{ checksum "setup.py" }}
workflows:
version: 2
build_and_deploy:
jobs:
- build:
filters:
tags:
only: /.*/
- runLibraryTest:
requires:
- build
filters:
tags:
only: /[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
- deploy:
requires:
- runLibraryTest
filters:
tags:
only: /[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
您正在创建一个虚拟环境,将其激活,然后在其外部安装 twine。
从 pip install --user --upgrade twine
中删除 --user
当新标签被推送到 GitHub 时,我正在使用 circleci 自动将我的 python 包部署到 PyPi。我一直在关注这个 tutorial
我的工作流程因错误 home/circleci/project/twitter_sentiment/bin/python: No module named twine
我已尝试确保在调用 twine 命令之前安装了 twine。我还尝试用 python -m twine
调用 twine 命令,据我了解,似乎 twine 没有添加到容器的路径中 - 这会导致 command not found
错误。
我该如何解决这个错误?
config.yml 文件
version: 2
jobs:
build:
docker:
- image: circleci/python:3.6
working_directory: ~/twitter-sentiment
steps:
- checkout
- run:
name: install dependencies
command: |
python3 -m venv twitter_sentiment
. twitter_sentiment/bin/activate
pip install -r requirements.txt
- save_cache:
paths:
- ./twitter_sentiment
key: v1-dependencies-{{ checksum "setup.py" }}
runLibraryTest:
docker:
- image: circleci/python:3.6
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "setup.py" }}
- run:
name: run twitter_sentiment tests
command: |
python3 -m venv twitter_sentiment
. twitter_sentiment/bin/activate
pip install -r requirements.txt
cd test/
python3 -m unittest test_twitterSentiment
- save_cache:
paths:
- ./twitter_sentiment
key: v1-dependencies-{{ checksum "setup.py" }}
- store_artifacts:
path: test-reports
destination: test-reports
deploy:
docker:
- image: circleci/python:3.6
steps:
- checkout
- restore_cache:
key: v1-dependencies-{{ checksum "setup.py" }}
- run:
name: verify git tag vs version
command: |
python3 -m venv twitter_sentiment
. twitter_sentiment/bin/activate
pip install -r requirements.txt
python3 setup.py verify
- run:
name: create package files
command: |
python3 setup.py sdist bdist_wheel
- run:
name: create .pypirc file
command: |
echo -e "[pypi]" >> .pypirc
echo -e "repository = https://pypi.org/legacy/"
echo -e "username = TeddyCr" >> .pypirc
echo -e " = $PYPI_PASSWORD" >> .pypirc
- run:
name: upload package to pypi server
command: |
python3 -m venv twitter_sentiment
. twitter_sentiment/bin/activate
pip install --user --upgrade twine
python -m twine upload dist/*
- save_cache:
paths:
- ./twitter_sentiment
key: v1-dependencies-{{ checksum "setup.py" }}
workflows:
version: 2
build_and_deploy:
jobs:
- build:
filters:
tags:
only: /.*/
- runLibraryTest:
requires:
- build
filters:
tags:
only: /[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
- deploy:
requires:
- runLibraryTest
filters:
tags:
only: /[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
您正在创建一个虚拟环境,将其激活,然后在其外部安装 twine。
从 pip install --user --upgrade twine
--user