0
0

Python 3 エンジニア認定基礎試験対策12 - 仮想環境とパッケージ

Posted at

はじめに

Python3エンジニア認定基礎試験の対策として自分用に執筆しています。

この記事はPython・執筆学びたての初心者が執筆しています。間違いがあるかもしれませんので、ぜひ各項目にある参考文献も確認してください。また、誤りがあればコメントで教えていただけると幸いです。

仮想環境とパッケージ

venvモジュールで仮想環境の作成と管理を行う

python3 -m venv tutorial-env

pipは"install", "uninstall", "freeze", "list"などのサブコマンドを持つ。

インストール

パッケージ指定で最新版をインストール

python3 -m pip install requests

パッケージ名の後ろに==とバージョン番号をつけると指定したバージョンをインストールできる

python3 -m pip install requests==2.6.0

既にインストールされている場合だと何も起こらないが、pip install --upgradeを実行すると最新版に更新する。

情報表示

指定したパッケージの情報

(tutorial-env)  $  pip  show  requests
---
Metadata-Version:  2.0
Name:  requests
Version:  2.7.0
Summary:  Python  HTTP  for  Humans.
Home-page:  http://python-requests.org
Author:  Kenneth  Reitz
Author-email:  me@kennethreitz.com
License:  Apache  2.0
Location:  /Users/akuchling/envs/tutorial-env/lib/python3.4/site-packages
Requires:

インストールされたすべてのパッケージを表示する

(tutorial-env)  $  pip  list
novas  (3.1.1.3)
numpy  (1.9.2)
pip  (7.0.3)
requests  (2.7.0)
setuptools  (16.0)

参考文献

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0