#100DaysOfCode in Python Transcripts
Chapter: Days 58-60: Twitter data analysis with Python
Lecture: Virtual environment and env variables

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Next we create our virtual environment,
0:03 and normally I would do that with python -m venv venv.
0:12 Here I got an error and I think that's
0:14 because I'm using Anaconda.
0:16 So I got another way of doing it,
0:21 which is virtualenv -p path to the Anaconda's Python
0:26 and then the name of the virtual environment.
0:29 I'm going to remove the one I had and run that.
0:37 Right, as I'm deactivating
0:39 and activating virtual environments
0:41 all the time, I made another useful alias to activate them.
0:47 So here we activated the virtual environment,
0:50 and to get out of the virtual environment,
0:53 deactivate currently there's nothing installed.
0:56 With the virtual environment activated I'm going
0:59 to install the dependencies.
1:02 pip install tweepy and wordcloud.
1:12 Right?
1:14 See what we have and notice that it
1:16 brought in some other dependencies
1:18 like pillow, which is an image library.
1:20 Numpy, matplotlib, I think those are
1:23 dependencies of wordcloud to show the nice visualization
1:27 we see towards the end of this lesson.
1:29 One final thing we need is to export
1:31 the Twitter, key, secret, and access token.
1:34 Let's do at the virtual environment level.
1:37 First, I'm going to deactivate it.
1:40 Then I'm going to edit the venv bin activate script.
1:44 That's a script that runs every time we
1:47 enable or activate this virtual environment.
1:50 You can ignore all this setup and go straight to the end.
1:54 I'm going to make more environment variables
1:57 and here you have to enter the key, secret,
2:00 and access token and secret you got
2:03 when you created the Twitter app.
2:05 I'm going to save that, activate the virtual environment
2:12 and now, if I look in my env,
2:18 we have these access tokens available in our environment.
2:22 In the next video you'll see how I use the os module
2:27 with the environment method to access
2:29 those variables in my notebook.
2:31 And that concludes the setup process.
2:33 In the next video we're finally going to write some code
2:36 to access data from our PyBites Twitter account.