Python环境安装 - Python2/3


Python环境安装

Windows安装python2/3

通过Scoop安装

1、添加versions镜像源 scoop bucket add versions

scoop bucket add versions
#添加versions
Checking repo... OK
The versions bucket was added successfully.

scoop bucket list
#查看bucket list 确认已经添加
Name     Source                                     Updated            Manifests
----     ------                                     -------            ---------
java     https://github.com/ScoopInstaller/Java     2022/9/16 6:17:40        226
main     https://github.com/ScoopInstaller/Main     2022/9/20 16:55:39      1083
versions https://github.com/ScoopInstaller/Versions 2022/9/21 13:50:53       359

2、通过命令进行搜索 scoop search python

scoop search python
Results from local buckets...

Name           Version   Source   Binaries
----           -------   ------   --------
python         3.10.7    main
winpython      3.10.5.0  main
anaconda2      2019.10   versions python.exe | pythonw.exe | python.exe
miniconda2     4.8.3     versions python.exe | pythonw.exe | python.exe
python-alpha   3.11.0b5  versions
python-rc      3.11.0rc2 versions
python27       2.7.18    versions
python310      3.10.7    versions
python35       3.5.4     versions
python36       3.6.8     versions
python37       3.7.9     versions
python38-beta  3.8.8rc1  versions
python38       3.8.10    versions
python39-beta  3.9.2rc1  versions
python39       3.9.13    versions
winpython37    3.7.7.1   versions
winpython3741  3.7.4.1   versions
winpython37cod 3.7.7.1   versions
winpython37ps2 3.7.6.0   versions
winpython38    3.8.9.0   versions
winpython38cod 3.8.7.0   versions
winpython38ps2 3.8.1.0   versions

3、选定对应的python版本进行安装
scoop install python27
scoop install python

scoop install python
##下载python 3
WARN  Purging previous failed installation of python.
ERROR 'python' inst installed correctly.
Removing older version (3.10.7).
'python' was uninstalled.
Installing 'python' (3.10.7) [64bit] from main bucket
python-3.10.7-amd64.exe (27.6 MB) [===========================================================================] 100%
Checking hash of python-3.10.7-amd64.exe ... ok.
Running pre_install script...
Running installer script...
Linking D:\scoop\apps\python\current => D:\scoop\apps\python\3.10.7
Creating shim for 'python3'.
Creating shim for 'idle'.
Creating shim for 'idle3'.
Persisting Scripts
Persisting Lib\site-packages
Running post_install script...

'python' (3.10.7) was installed successfully!
Notes
-----
Allow applications and third-party installers to find python by running:
"D:\scoop\apps\python\current\install-pep-514.reg"

scoop install python27
##下载python 2
Installing 'python27' (2.7.18) [64bit] from versions bucket
python-2.7.18.amd64.msi (19.6 MB) [===========================================================================] 100%
Checking hash of python-2.7.18.amd64.msi ... ok.
Extracting python-2.7.18.amd64.msi ... done.
Linking D:\scoop\apps\python27\current => D:\scoop\apps\python27\2.7.18
Creating shim for 'python2'.
Creating shim for 'idle'.
WARN  Overwriting shim ('idle.cmd' -> 'idle.bat') installed from python
WARN  Overwriting shim ('idle' -> 'idle.bat') installed from python
Creating shim for 'idle2'.
Running post_install script...
Traceback (most recent call last):
  File "D:\scoop\apps\python27\current\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "D:\scoop\apps\python27\current\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "D:\scoop\apps\python27\current\lib\ensurepip\__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "D:\scoop\apps\python27\current\lib\ensurepip\__init__.py", line 219, in _main
    default_pip=args.default_pip,
  File "D:\scoop\apps\python27\current\lib\ensurepip\__init__.py", line 123, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "D:\scoop\apps\python27\current\lib\ensurepip\__init__.py", line 31, in _run_pip
    import pip._internal
  File "c:\users\liyalong\appdata\local\temp\tmpqsrthd\pip-19.2.3-py2.py3-none-any.whl\pip\_internal\__init__.py", line 40, in <module>
  File "c:\users\liyalong\appdata\local\temp\tmpqsrthd\pip-19.2.3-py2.py3-none-any.whl\pip\_internal\cli\autocompletion.py", line 8, in <module>
  File "c:\users\liyalong\appdata\local\temp\tmpqsrthd\pip-19.2.3-py2.py3-none-any.whl\pip\_internal\cli\main_parser.py", line 7, in <module>
  File "c:\users\liyalong\appdata\local\temp\tmpqsrthd\pip-19.2.3-py2.py3-none-any.whl\pip\_internal\cli\cmdoptions.py", line 29, in <module>
  File "c:\users\liyalong\appdata\local\temp\tmpqsrthd\pip-19.2.3-py2.py3-none-any.whl\pip\_internal\utils\ui.py", line 60, in <module>
  File "c:\users\liyalong\appdata\local\temp\tmpqsrthd\pip-19.2.3-py2.py3-none-any.whl\pip\_internal\utils\ui.py", line 53, in _select_progress_class
LookupError: unknown encoding: cp65001
'python27' (2.7.18) was installed successfully!
Notes
-----
Python 2 is EOL. Upgrade to Python 3 by running: scoop install python

4、验证安装使用命令python2 python3,出现以下界面即可

python2
Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

python3
Python 3.10.7 (tags/v3.10.7:6cc6b13, Sep  5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

渗透测试小白

如果您觉得满意,一分一毛也是爱

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值