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

No pit version: windows10 installs Python and configures the environment variables of Python and pip.

編輯:Python

One 、 install python

python The installation package can be downloaded from the official website :https://www.python.org/downloads/

This may be the most detailed in the whole network python Installation tutorial (windows):

https://blog.csdn.net/weixin_58753619/article/details/123014634

Do not check... During installation Add python3.7 to path.

Two 、 master python Configuration of environment variables , And why to configure environment variables separately , Benefits of configuring environment variables separately , How to validate python and pip Whether the environment variables of are configured successfully ?

1、 Generally, everyone is learning python When , The first chapter is environment construction , Configure environment variables . General tutorial may let you directly check add environment variables to during installation PATH The option to , But I generally don't recommend that you do this , Because there may be pip Useless situation . It is recommended to manually configure the environment variables .

python3 Once installed ,python3 The installation package of is integrated with pip, No need to install again pip. To configure pip The environment variable of .

1) environment variable -- Create one in the system variable PYTHON_HOME, Inside python Installation path and pip Installation path for .

2) And then PYTHON_HOME In the form of variables :%PYTHON_HOME%.

In environment variable -- System variables --path Configure environment variables in .

In this case , Switch later python edition , Just change PYTHON_HOME The corresponding value is just .

2、 After the environment variables are configured , open cmd window , Input python -V, Will output the currently installed on your computer python Version number . Or just type in python, Hit enter , If you don't prompt, you can't find the command , That is, the configuration is successful .

【 it is to be noted that : After configuring environment variables , To reopen a new cmd Window execution command verification . The previously opened window will not load the latest environment variable configuration in real time 】

python3 and pip Installation successful

3、 ... and 、 Pit encountered

1. Use pip Report errors

before windows10 Computer installed LR, Later, I used software to LR Even the registry was uninstalled . however LR Generated pip Not uninstalled .

There are multiple in the computer pip, When I finish installing python, Use pip It's a mistake .

In this case , First where pip, View in PC pip There are several , Then open the environment variable - System variables -path, Delete computers that are not python Self contained pip Environment variables of , Delete them all .

Be careful : When configuring environment variables ,d Don't put the beginning of the disc on the front , Otherwise, the configured style will change .

For example, the configuration is completed path Environment variables in , The system should be based on path Environment variables configured inside , From top to bottom one by one .

2.pip newspaper No module named 'pip' What about mistakes ?

link :https://jingyan.baidu.com/article/6f2f55a19fad97f4b93e6c80.html#:~:text=%E6%9C%89%E6%97%B6%E5%80%99%E5%9C%A8%E6%89%A7%E8%A1%8Cpip%E6%9B%B4%E6%96%B0%E5%A4%B1%E8%B4%A5%E5%90%8E%EF%BC%8C%E5%86%8D%E6%AC%A1%E6%89%A7%E8%A1%8Cpip%E5%91%BD%E4%BB%A4%E6%97%B6%E4%BC%9A%E6%8F%90%E7%A4%BAModuleNotFoundError%3A%20No%20module,named%20%27pip%27%E9%94%99%E8%AF%AF%EF%BC%8C%E5%AF%BC%E8%87%B4pip%E5%91%BD%E4%BB%A4%E6%97%A0%E6%B3%95%E4%BD%BF%E7%94%A8%E3%80%82%20%E6%AD%A4%E6%97%B6%E5%8F%AA%E9%9C%80%E8%A6%81%E6%89%A7%E8%A1%8C2%E6%9D%A1%E5%91%BD%E4%BB%A4%E5%8D%B3%E5%8F%AF%E5%AE%8C%E6%88%90%E4%BF%AE%E5%A4%8D%E6%93%8D%E4%BD%9C%EF%BC%81

summary :

When in execution pip update , Failure or warning occurred , Re execution pip Command error . Right click to open as administrator windows powershell. Perform the following steps in order 2 One command to complete the repair .

python -m ensurepip

python -m pip install --upgrade pip

3.Pycharm Unable to load file xx\Scripts\Activate.ps1, Because scripts are not allowed to run on this system .

link :https://blog.51cto.com/aiyc/4802007

Right click to open as administrator windows powershell.


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