程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Summary of commands frequently used in Python

編輯:Python

see Python Version of

python --version

Conda View all virtual environments

conda info --env

Conda Enter and select a virtual environment

conda activate xxx

pip Unload a package

pip uninstall imbalanced-learn

pip Install a specific version of the package

pip install imbalanced-learn==0.8.0

pip View details of a package

$ pip show <package-name>

give the result as follows :

$ pip show pip
Name: pip
Version: 18.1
Summary: The PyPA recommended tool for installing Python packages.
Home-page: [https://pip.pypa.io/](https://pip.pypa.io/)
Author: The pip developers
Author-email: [email protected]
License: MIT
Location: /usr/local/lib/python2.7/site-packages
Requires:
Required-by:

pip View all installed packages and versions

pip list

give the result as follows

Package Version
----------------------- ---------
absl-py 0.15.0
astunparse 1.6.3
cachetools 4.2.4
certifi 2021.10.8
charset-normalizer 2.0.9
click 8.0.4
colorama 0.4.4
cx-Oracle 8.3.0
cycler 0.11.0
dataclasses 0.8
et-xmlfile 1.1.0
Flask 2.0.3

pip Check the versions of a package

It can be used pip install package_name== To see which versions of the package .

pip install panda==
Collecting panda==
Could not find a version that satisfies the requirement panda== (from versions: 0.1.5.macosx-10.9-x86_64, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.3.1)
No matching distribution found for panda==

pip establish requrement.txt , 

pip freeze >requirements.txt

The result is to export all packages and versions of the environment to requirements.txt In file ,

If you use conda It seems to be the following command , Never used

conda list -e > requirements.txt

pip Import requrement.txt 

pip install -r requirements.txt

pip Check whether all dependent packages are installed and compatible with the version

$ pip check
No broken requirements found.

If there is a problem, the results are as follows

$ pip check
pyramid 1.5.2 requires WebOb, which is not installed.
$ pip check
pyramid 1.5.2 has requirement WebOb>=1.3.1, but you have WebOb 0.8.


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved