#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, and normally I would do that with Python -m venv venv. Here I got an error and I think that's
0:15 because I'm using Anaconda. So I got another way of doing it, which is virtualenv -p path to the Anaconda's Python
0:27 and then the name of the virtual environment. I'm going to remove the one I had and run that. Right, as I'm deactivating
0:40 and activating virtual environments all the time, I made another useful alias to activate them. So here we activated the virtual environment,
0:51 and to get out of the virtual environment, deactivate currently there's nothing installed. With the virtual environment activated I'm going
1:00 to install the dependencies. pip install tweepy and wordcloud. Right? See what we have and notice that it
1:17 brought in some other dependencies like pillow, which is an image library. Numpy, matplotlib, I think those are
1:24 dependencies of wordcloud to show the nice visualization we see towards the end of this lesson. One final thing we need is to export
1:32 the Twitter, key, secret, and access token. Let's do at the virtual environment level. First, I'm going to deactivate it.
1:41 Then I'm going to edit the venv bin activate script. That's a script that runs every time we enable or activate this virtual environment.
1:51 You can ignore all this setup and go straight to the end. I'm going to make more environment variables and here you have to enter the key, secret,
2:01 and access token and secret you got when you created the Twitter app. I'm going to save that, activate the virtual environment
2:13 and now, if I look in my env, we have these access tokens available in our environment. In the next video you'll see how I use the os module
2:28 with the environment method to access those variables in my notebook. And that concludes the setup process.
2:34 In the next video we're finally going to write some code to access data from our PyBites Twitter account.