1. 程式人生 > >win10系統同時安裝python2和python3

win10系統同時安裝python2和python3

2.4 pen 管理 enc pack 顯示 sta port bsp

1、官網下載python2和python3版本

2、安裝python3,勾上Add Python3.5 to PATH,自定義選擇安裝目錄,安裝,驗證:WIN+R--->cmd,輸入python看看是否安裝python3

3、安裝python2,自定義安裝目錄,顯示不能將路徑添加到環境變量,一路next,安裝

4、添加python2的安裝路徑和python2安裝路徑下的Scripts目錄到系統環境變量Path中

5、修改python2的安裝目錄下python.exe和pythonw.exe為python2.exe和pythonw2.exe,WIN+R--->cmd,輸入python2驗證python2是否安裝

6、python2-m pip install --upgrade pip --force-reinstall,此時pip2代表python2中的包管理工具,pip代表python3的包管理工具,pip2 -V和pip -V驗證

7、安裝numpy庫,matplotlib庫,python2執行pip2 install numpy,pip2 install matplotlib,python3執行pip install numpy,pip install matplotlib

8、python2配置opencv2.4.10,將\opencv\build\python\2.7\x64 這個目錄下:cv2.pyd 復制到:python2安裝目錄\Lib\site-packages\目錄下,win+R--->cmd,輸入python2,輸入import cv2檢查是否安裝成功

10、pycharm中新建project,在interpreter中後面添加python2安裝目錄下的python2.exe即可創建python2的代碼,同樣在interpreter中後面添加python3安裝目錄下的python.exe即可創建python3的代碼

win10系統同時安裝python2和python3