To avoid installing too many Python toolkits causing the Python directory to be bloated and even incompatible between packages, it is necessary to install the virtual Python environment--virtualenv for Python. With virtualenv installed, you can create any number of small virtual Python environments based on tasks, install specific packages for specific projects, and delete the corresponding virtual environments directly after the experiment.
Virtualenv can download the installation by visiting the following link: http://pypi.python.org/pypi/virtualenv.
Open cmd under Windows platform and go to the VIRTUALENV installation package to extract the directory.
$ python Install setup.py
Once the installation is complete, you can use Virtualenv to create a new environment. Virtualenv-h View help information. Create and activate the virtual environment.
$ virtualenv geo_env$ CD geo_env\scripts$ start activate
Install the required packages in a virtual environment
$ pip Install Pygeocoder
Run your own project in a virtual environment
From pygeocoder import geocoderif __name__ = = ' __main__ ': address = ' 207 N. Defiance St, Archbold, OH ' Print (geocoder.ge Ocode (address) [0].coordinates]
Run the above code to get the latitude and longitude of the address:
$ python search.py (41.521954,-84.306691)
End of experiment, close virtual environment
$ deactivate
If you do not need the environment, you can delete the directory for that virtual environment. If you need to create a new environment based on a virtual environment, you can
$ virtualenv--download-p Geo_env\scripts\python.exe geo_env_new
The new geo_env_new environment has a geo_env of existing packages.
If the Pycharm ide,pycharm is installed, the virtualenv is integrated and the new project enters
File-->settings-->project-->project Interpreter
Select an existing environment, or add local, or create virtualenv.
Learn "Python network programming (third edition)" (Brandon Rhodes) with a little memory.
This article is from the "Small Network programming Novice" blog, please be sure to keep this source http://ustchch.blog.51cto.com/12924303/1934769
Python3 Virtual Environment setup under Windows