1、在https://www.python.org/ python官网下载python-3.7.6-amd64.exe文件,并在win10 下自定义安装成功,勾选对所有用户以及增加python3.7路径,勾选安装pip 。
在命令提示符里输入python,验证安装版本。
D:\数据分析>python
Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
2、命令提示符下输入pip,显示pip命令,然后升级pip
pip install --upgrade pip
此时出现错误并告警。
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
3、输入python -m pip install --upgrade pip ,同样出现上面的错误
这是因为服务器连接超时,使用下方代码即可解决(因为pip源在国外,所以连起来比较慢,可以改用国内的源)
python -m pip install --upgrade pip -i https://pypi.douban.com/simple
4、还是有问题,使用如下命令重新安装,仅针对当前用户安装--user
python -m pip install --user --upgrade pip
Requirement already up-to-date: pip in c:\users\yb\appdata\roaming\python\python37\site-packages (20.0.2)
5、 查看pip安装版本
python -m pip --version
pip 20.0.2 from C:\Users\YB\AppData\Roaming\Python\Python37\site-packages\pip (python 3.7)
6、运行pip install myqr, 出现告警,提示引用到旧的pip。
这种情况以后针对编译会有问题。需要修改pip的PAHT路径为--user安装的路径。
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
参考:https://github.com/pypa/pip/issues/5599
7、重新安装python(不默认安装pip)和pip。下载pip-20.0.2.tar.gz,并解压到对应的目录。输入python setup.py install 安装pip
下载pip网址是:https://pypi.org/project/pip/#files
D:\数据分析相关内容\pip-20.0.2>python setup.py install
Traceback (most recent call last):
File "setup.py", line 8, in <module>
from setuptools import find_packages, setup
ModuleNotFoundError: No module named 'setuptools'
这个问题是因为setuptools出问题了,我们只需要下载它的包安装就行了
去官网下载压缩包:setuptools_dowload,下载后解压包,切换到它所在的包文件夹 ,使用python setup.py install 来安装即可.
参考:https://www.jianshu.com/p/9e15a695f489
此时再重新进入pip目录下安装pip ,运行成功。
8、升级pip
D:\program files\Python37>pip install --upgrade pip
Requirement already up-to-date: pip in d:\program files\python37\lib\site-packages\pip-20.0.2-py3.7.egg (20.0.2)
或者输入 :python -m pip install --upgrade pip -ihttp://pypi.douban.com/simple --trusted-host pypi.douban.com,并回车。
9、安装pip模块 pip install 【模块名字】,例如pip install myqr
10、下载vscode 并安装
https://code.visualstudio.com/
在vscod的extensions里选择python ,安装,运行helloworld 后提示pylint 未安装,按照提示安装即可,(或者在cmd终端输入 pip install pylint)python的环境就搭建好了
打开一个py文件就可以运行了。