-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME_python-install.html
More file actions
70 lines (50 loc) · 1.48 KB
/
README_python-install.html
File metadata and controls
70 lines (50 loc) · 1.48 KB
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
<pre>
goal: easily install my python code to standard locations so I don't
have filesystem specific directories to keep track of
Even without root, you should be able to do "python setup.py install --user"
https://docs.python.org/3/distutils/introduction.html#distutils-simple-example
foo.py:
class foo:
def hello(self):
print "hello!"
main.py
import foo
myfoo = foo.foo()
myfoo.hello()
> python main.py
#hello!
setup.py:
from distutils.core import setup
setup(name='foo',
version='1.0',
py_modules=['foo'],
)
> python setup.py sdist
# now install it
mkdir tmp
cp dist/foo-1.0.tar.gz tmp/
cd tmp
tar zxvf foo-1.0.tar.gz
cd foo-1.0
python setup.py install --user
####
This installs in .local. Now I can "import foo" when running as
mpsb. I could also do root install to make available for everyone.
#### install using pip.
http://python-packaging.readthedocs.io/en/latest/minimal.html
The "-e" links to source files, so changes made in source are
available immediately.... but don't move the source!
pip install --user -e .
================================
Put on github:
on github create project "pythoninstalltest"
> https://github.com/michaelbrownid/pythoninstalltest.git
Create .gitignore
# set up git
git config --global user.email "michaelbrown14142@gmail.com"
git config --global user.name "michaelbrownid"
git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/michaelbrownid/pythoninstalltest.git
git push -u origin master