Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install third-party modules in multiple environments of Python3

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to install third-party modules in a variety of environments in Python3". The explanation in this article is simple and clear and easy to learn and understand. Please follow the editor's train of thought to study and learn how to install third-party modules in a variety of Python3 environments.

The method of installing third Party Module in multiple environments of Python3

Python in addition to its own standard library, other developers have written some of their own modules, called third-party modules, third-party modules further expand the functions of Python. The main way to install third-party modules is to use Python's pip tool. Third-party modules for Python can be securely downloaded from https://pypi.python.org/.

The executable file of the pip tool is called pip on Windows and pip3 on OS X and Linux. On Windows and OS X, pip is automatically installed with Python, but on Linux, it must be installed separately, on Windows, under the scripts directory of the installation directory, on OS X, and under the bin directory of the installation directory. To install pip3 on Linux, simply open a new terminal window and type get install Python3-pip or install Python3-pip.

To install a third-party module using pip, you need to run the pip tool on the command line, and then enter the install command to keep up with the name of the module you want to install. For example, on Windows, enter pip install ModuleName,ModuleName as the name of the module, the same below. On OS X or Linux, you must use the sudo prefix to run pip3, which requires administrator privileges to install the module, such as sudo pip3 install ModuleName.

If you want to upgrade installed modules to the latest version, run pip install-U ModuleName (or run pip3 install-U ModuleName on OS X and Linux). After installing the module, you can run import ModuleName in an interactive environment to test the success of the installation. If you want to display an error message, you can assume that the module has been successfully installed.

Example: the method of installing third-party module pyperclip and updating pip under Windows.

C:\ Users\ Administrator > pip install pyperclip

Collecting pyperclip

Downloading https://files.pythonhosted.org/packages/33/15/f3c29b381815ae75e275

89583655f4a8567721c541b8ba8cd52f76868655/pyperclip-1.6.2.tar.gz

Installing collected packages: pyperclip

Running setup.py install for pyperclip... Done

Successfully installed pyperclip-1.6.2

You are using pip version 9.0.3, however version 10.0.1 is available.

You should consider upgrading via the 'python-m pip install-upgrade pip' comm

And.

If the pip version is too old, enter python-m pip install-- upgrade pip to upgrade the pip version. There is no upgrade here, depending on the situation.

C:\ Users\ Administrator > python-m pip install-- upgrade pip

Collecting pip

Downloading https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b

44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB)

35% | █▎ | 460kB 147kB/s eta 0:00:06

36% | █▌ | 471kB 147kB/s eta 0:00:06

36% | █▊ | 481kB 129kB/s eta 0:00:07

37% | █ | 491kB 104kB/s eta 0:00:08

38% | █▎ | 501kB 104kB/s eta 0:00:0

39% | █▌ | 512kB 159kB/s eta 0:00:0

39% | █▉ | 522kB 137kB/s eta 0:00:0

40% | █ | 532kB 137kB/s eta 0:00:0

41% | █▎ | 542kB 134kB/s eta 0:00:

42% | █▌ | 552kB 134kB/s eta 0:00:

43% | █▉ | 563kB 75kB/s eta 0:00:1

43% | █ | 573kB 75kB/s eta 0:00:1

44% | █▎ | 583kB 81kB/s eta 0:00:

45% | █▌ | 593kB 95kB/s eta 0:00:

46% | █▉ | 604kB 95kB/s eta 0:00:

46% | █ | 614kB 111kB/s eta 0:00

47% | █▎ | 624kB 100kB/s eta 0:0

48% | █▌ | 634kB 99kB/s eta 0:00

49% | █▉ | 645kB 99kB/s eta 0:00

50% | █ | 655kB 86kB/s eta 0:00

50% | █▎ | 665kB 142kB/s eta 0:

51% | █▌ | 675kB 102kB/s eta 0:

52% | █▉ | 686kB 83kB/s eta 0:0

53% | █ | 696kB 83kB/s eta 0:0

54% | █▎ | 706kB 69kB/s eta 0:

54% | █▌ | 716kB 69kB/s eta 0:

55% | █▉ | 727kB 60kB/s eta 0:

56% | █ | 737kB 60kB/s eta 0:

57% | █▎ | 747kB 64kB/s eta 0

57% | █▌ | 757kB 57kB/s eta 0

58% | █▉ | 768kB 55kB/s eta 0

59% | █ | 778kB 65kB/s eta 0

60% | █▎ | 788kB 65kB/s eta

61% | █▌ | 798kB 65kB/s eta

61% | █▉ | 808kB 66kB/s eta

62% | █ | 819kB 58kB/s eta

63% | █▎ | 829kB 77kB/s eta

64% | █▌ | 839kB 54kB/s eta

64% | █▉ | 849kB 54kB/s eta

65% | █ | 860kB 67kB/s eta

66% | █▎ | 870kB 66kB/s et

67% | █▌ | 880kB 66kB/s et

68% | █▉ | 890kB 58kB/s et

68% | ██ | 901kB 58kB/s et

69% | ██▎ | 911kB 63kB/s e

70% | ██▌ | 921kB 65kB/s e

71% | ██▉ | 931kB 48kB/s e

72% | ███ | 942kB 66kB/s e

72% | ███▎ | 952kB 47kB/s

73% | ███▌ | 962kB 47kB/s

74% | ███▉ | 972kB 53kB/s

75% | ████ | 983kB 43kB/s

75% | ████▎ | 993kB 53kB/s

76% | ████▋ | 1.0MB 43kB/s

77% | ████▉ | 1.0MB 44kB/s

78% | █ | 1.0MB 43kB/s

79% | █▎ | 1.0MB 51kB/

79% | █▋ | 1.0MB 45kB/

80% | █▉ | 1.1MB 51kB/

81% | ██ | 1.1MB 46kB/

82% | ██▎ | 1.1MB 46kB

83% | ██▋ | 1.1MB 49kB

83% | ██▉ | 1.1MB 41kB

84% | ██ | 1.1MB 51kB

85% | ██▎ | 1.1MB 42k

86% | ██▋ | 1.1MB 47k

86% | ██▉ | 1.1MB 43k

87% | ██ | 1.1MB 45k

88% | ██▎ | 1.2MB 50

89% | ██▋ | 1.2MB 50

90% | ██▉ | 1.2MB 40

90% | ██ | 1.2MB 44

91% | ██▎ | 1.2MB 4

92% | ██▋ | 1.2MB 4

93% | ██▉ | 1.2MB 4

93% | ██ | 1.2MB 3

94% | ██▎ | 1.2MB

95% | ██▋ | 1.2MB

96% | ██▉ | 1.3MB

97% | ██ | 1.3MB

97% | ██▎ | 1.3MB

98% | ██▋ | 1.3MB

99% | ██▉ | 1.3MB

100% | ██ | 1.3m

B 32kB/s

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-10.0.1

C:\ Users\ Administrator >

The interactive environment tests whether the installation is successful, and no error message is displayed, indicating that the installation is successful.

Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32

Type "copyright", "credits" or "license ()" for more information.

> import pyperclip

> > >

> > >

> > >

Thank you for your reading, the above is the content of "how to install third-party modules in various environments of Python3". After the study of this article, I believe you have a deeper understanding of the problem of how to install third-party modules in a variety of Python3 environments. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report