Yesterday want to run a machine learning code, in the WIN10 system to configure the day of the Python environment, is really a headache, ready to write a blog to help the next need to configure the Environment brothers.
1. Download Anaconda
According to yesterday's experience, found that Anaconda is really useful. : https://www.anaconda.com/download/I'm under the 64-bit.
After the good is installed, the installation process is very simple, here will not write, but the suggestion is to add to the environment variable, the back of the province to add, trouble.
Locate Anaconda Prompt in the menu bar and run as administrator. We need to set Anaconda warehouse image, because the default connection is the foreign mirror address, download speed is slow, we changed the mirror address to Tsinghua Open source software Mirror station, open Anaconda Prompt, enter:
Conda config--add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/Conda config- -Set show_channel_urls Yes
2. Installing TensorFlow
Continue typing in the Anaconda Prompt window:
Conda create-n TensorFlow python=3.5
Represents the creation of a tensorflow dependent environment, because TensorFlow currently does not support Python3.6, where we use Python3.5.
Continue to watch console output:
Fetching package metadata ...... ..... Solving Package Specifications:. Package Plan forInstallationinchEnvironment D:\Program Files\anaconda\envs\tensorflow:the following NEW packages would be INSTALLED:PIP: 9.0.1-py35_1 https://Mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/freePython:3.5.3-0Https//Mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/freeSetuptools:27.2.0-py35_1 https://Mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/freeVs2015_runtime:14.0.25123-0Https//Mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/freeWheel0.29.0-py35_0 https://Mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/freeProceed ([y]/n)? Y
Prompt us to install which dependent software, input ' Y ', enter.
The console continues to output:
python-3.5.3-0 -% |###############################| Time:0:xx: the 754.91kb/Ssetuptools- -. -% |###############################| Time:0:xx:xx 1.92MB/Swheel-0.29.0-P -% |###############################| Time:0:xx:xx 2.68MB/Spip-9.0.1-py35 -% |###############################| Time:0:xx:xx 2.31MB/s## to activate ThisEnvironment, use:#>Activate tensorflow## to deactivate ThisEnvironment, use:#>Deactivate tensorflow##* forPower-usersusingbash, you must source#
Download install dependent software, the use of the Tsinghua University Mirror Warehouse, so download speed quickly.
Installing TensorFlow
Pip install-i https://https://mirrors.tuna.tsinghua.edu.cn/tensorflow/windows/cpu/ TENSORFLOW-1.1.0-CP35-CP35M-WIN_AMD64.WHL
You can also open https://mirrors.tuna.tsinghua.edu.cn/tensorflow/to select the appropriate WHL file address to install, or open https:// mirrors.tuna.tsinghua.edu.cn/help/tensorflow/visual selection of WHL version.
When the installation is successful, it displays the following
Successfully installed numpy-1.12. 1 protobuf-3.3. 0 six-1.10. 0 tensorflow-1.1. 0 werkzeug-0.12. 2
Continue typing:
Activate TensorFlow
Indicates that the TensorFlow virtual environment is activated, and when TensorFlow is not used, the deactivate TensorFlow is turned off.
3. Testing
Input, if the result is the same, the installation is successful.
You can enter the PIP list to view the version of TensorFlow
4. Install OpenCV (Resolve import cv2 issues)
OPENCV installation can be said to be very pit, in Baidu to find a variety of tutorials, tried a day before the configuration is good.
Start on someone else's blog to see Download a OPENCV, and then find a cv2.pyd file inside, copied to the Anaconda directory under the Site-packages folder: D:\Anaconda3\Lib\site-packages, the results found no.
And then use the Conda to directly install
The result failed, it seems that version is not allowed, really is a headache.
And then see a way
First download a WHL file, about OpenCV, here:
Choose the version you need, I am under the Cp36m-sim AMD64 (corresponding to the cv3.4 version, python3.6 version)
After that, put it in the corresponding folder in Conda, then open Anaconda Prompt, enter
Pip install opencv_python-3.4. 0
Note yourself under the version, name on, failed to see if there is no administrator running.
Found success!!!!
Re-check and check
It did succeed.
5.pygame Installation
① began to go to the official website download Pygame, ( Focus: you want to according to your own current version of Python installed and then download the corresponding Pygame on the official website, can not download and your current version of Python does not correspond to the official website has been prepared for you The official address is below
http://www.pygame.org/download.shtml
② If your current Python version is after 3.4, 3.5,3.6 then please go to the following website to download
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame Https://pypi.python.org/pypi/Pygame
You can choose to download the. whl file, and under the same open Anaconda Prompt, enter
Pip install pygame-1.9. 4-CP36-CP36M-WIN_AMD64.WHL
Of course, can also not download, direct input
Pip install-i https://pypi.tuna.tsinghua.edu.cn/simple pygame
You may encounter a problem with a PIP version that is too low during installation, and then install it as prompted to update pip
6. Use in Pycharm
It took a long time to configure the environment and it was a headache for the pycharm.
First, run Pycharm as an administrator, and then open setting
Next, select the Python.exe in the Anaconda directory
Select OK and click OK.
Put a name reminder what to clean up and run!!! Run up!!!
See blog:
80528816
68928563
79132349
Https://www.cnblogs.com/nosqlcoco/p/6923861.html
Use Anaconda to configure OpenCV, TensorFlow, Pygame and use in Pycharm under WIN10