-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.txt
128 lines (84 loc) · 7.46 KB
/
test.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
Here is another test file
and now i am changing it ever so slightly.
Now again.
Setting up the OSF
Work in Progress, please add or edit as necessary.
This page provides detailed instructions for getting up and running with an OSF installation on your local computer. These instructions are prepared for researchers, technical staff, or developers new to python, and primarily focus on Mac OS ( >=10.7).
If you are already familiar with Python, more compact instructions can be found in the OSF README file.
Preparing your development environment for the OSF
Before you can begin to install the OSF, you will first need to install several pre-requisites. You may already have these installed, but instructions are provided to ensure that things are up-to-date.
Installing Homebrew
Homebrew is a package manager that allows you to install lots of very cool things that are not just python related. You most likely have homebrew.
Homebrew is a package manager that allows you to install many cool things easily (not just python tools)- it will greatly ease the process of installing OSF requirements. To see if Homebrew is already installed, open a new window in your terminal and type
brew
If you see a list of options you already have homebrew and you can skip this section. If not you will want to install homebrew globally, not just in your osf environment. To install it, open a new terminal window and run the following command.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Homebrew installation will ask you to press ENTER to continue and enter your password. When it’s done installing type
brew doctor
This will show any possible errors or other things that need to be done. Homebrew is quite clear about what to do in these cases; usually you just need to copy paste the provided commands and run them.
Installing Python
Now that we have Homebrew, we can install Python. Python is the programming language that much of the OSF is written in. Even if it is already on your computer, installing the newest version via Homebrew will avoid many common problems for new developers. It will also automatically install pip, which is a tool to manage Python packages. To install Python, go to your terminal and run
brew install Python
Updating your Path
Now that you have installed Homebrew, you will need to make a change to help your computer find the newly installed software. This is done by editing the variable PATH in a file loaded whenever you open a new terminal window.
The file will usually be in your home directory (such as /Users/your_username, commonly abbreviated as ~). If you are using bash this file could be .bash_profile, .bashrc, or .profile. If you are using another terminal like zsh you will need to add this section to the file .zshrc. Further tools installed later like virtualenvwrapper will work with bash, zsh or ksh.
Note
You most likely have bash, and if you don’t know what this means, this article can explain.
open -e ~/.bash_profile
If you get the error “The file .bash_profile does not exist,” then run
touch ~/.bash_profile
open -e ~/.bash_profile
In your text editor, add the following line to your .bash_profile
PATH=$PATH:/usr/local/bin
And save it.
Finally run
source ~/.bash_profile
to load the file.
Installing XCode and Java
You will also need the XCode command line tools and Java to install the OSF. In the terminal, run
xcode-select --install
Followed by
brew install Caskroom/cask/java
Virtual Environments
A common problem for software developers is how to deal with different projects that all require different settings or library versions. If your computer had only a single work environment shared by multiple projects, you would not be able to use two versions of libraries simultaneously, and updating a library for one project could break other things that depend on an older version.
To avoid this problem, Python provides a tool called virtual environments (a.k.a. virtualenvs). Since it is not always possible to avoid conflicts- and not often practical to use a different computer for each thing you work on- it’s best to use Virtual Environments. This lets you have separate, individually customized Python setups for each thing you are working on.
You can install this tool using pip, which is a tool for installing and managing Python packages. This seems like an extra layer of complexity, but working with libraries in a package format makes it much easier to manage and update your applications.
Installing Virtualenv
Virtualenv is the tool we use to isolate the python environments for each project you need to run. Installing it is easy. Open Terminal and type
pip install virtualenv
Installing Virtualenvwrapper
Now that you installed virtualenv, why not add an extension that makes it even easier to use virtualenv (Programmers like shortcuts). Virtualenvwrapper does what its name suggests, it wraps the virtual environments so that you can easily manage them and work with multiple environments at once. To install virtualenvwrapper, type this into Terminal
pip install virtualenvwrapper
To conclude the installation you need to add the following lines to the end of your bash profile file.
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh
The first line shows where the virtual environments are. If you installed virtualenv normally you shouldn’t need to adjust this setting. The second line is the folder that has your development projects, this folder should exist before you do anything with virtualenvwrapper. Finally the third file is the location of the virtualenvwrapper.sh file.
Note
If you don’t know where a certain file is on your computer you can use the find command in Terminal. To search for virtualenvwrapper.sh file anywhere on your computer type the following:
find / -name "virtualenvwrapper.sh"
Once you made the changes remember to load the changed file by typing:
source ~/.bash_profile
Creating your virtual environment
You now have a solid development environment framework you can use for any of your projects. To start using OSF we will create a virtual environment for it.
First lets see which virtual environments you already have by using the command to show the short version of your existing environments.
lsvirtualenv -b
You’ll see that there isn’t anything there yet. Let’s create a virtual environment titled “try”
mkvirtualenv try
When you make a virtual environment it will automatically enter that environment so to get out of virtual environments type:
deactivate
now when you run the lsvirtualenv command above you will see that “try” is listed. To start working on this virtual environment type
workon try
Now the terminal lines will change to reflect that you are currently in that environment:
(try)$
You can switch environments by typing the name of another existing environment
workon another
These commands work from within other environments. To get out of the virtual environment again type:
deactivate
To delete a virtual environment type:
rmvirtualenv try
Now we can go ahead and create the OSF virtual environment and work on it. This will create and start the virtual environment.
mkvirtualenv osf
Next time you need to start osf you will have to type:
workon osf
Remember that the reason we created these environments is that next time we need to install something just for OSF we will go to the osf virtual environment we just created. Most the remainder of this page will be within this virtual environment unless otherwise stated.