https://www.python.org/ |
http://www.indeed.com/jobtrends?q=Java,+PHP,+Perl,+.Net,+Python&relative=1 |
Python is supported in major OS platforms: Windows, Mac and Linux. QNAP NAS (QTS) is Linux/Ubuntu based OS, QNAP App Center also supports Python 2.7. However, developing QNAP Apps must consider the platform-support, workable packages on Linux/Ubuntu do not guarantee the same feature on QTS (a light-weight version of Linux for NAS performance and security issues).
http://download.qnap.com/QPKG/Python_2.7_arm-x19.zip |
Optware: search "py27" to get packages for Python 2.7 |
Optware: search "py26" and get many packages for Python 2.6 |
ipkg install python26
# some packages for 2.6 version
ipkg install py26-setuptools # install packages with .py source
ipkg install py26-lxml # parse HTML, XML
ipkg install py26-cjson # parse JSON
ipkg install py26-psycopg2 # connect PostgreSQL
To guarantee the current version of Python is 2.6, I wrote following commands in the file "setpy26". Finally, the version is "Python 2.6.8".
unlink /opt/bin/python # unlink other Python version installed by Optware
unlink /urs/bin/python # unlink other Python version installed from App Center
ln -s /opt/bin/python2.6 /usr/bin/python # link python to 2.6 versionPython packages are developed based on open source projects, that is source codes can be manually downloaded and installed into Python 2.6 (but it may not work for all packages since module dependencies are different between Linux and QTS). Following commands download pyquery package with wget, uncompress (tar) sources into a directory and install through its setup.py.
ln -s /opt/bin/python2.6 /opt/bin/python
python --version # check current version
wget https://pypi.python.org/packages/source/p/pyquery/pyquery-1.2.4.tar.gz --no-check-certificate
tar xf pyquery-1.2.4.tar.gz
cd pyquery-1.2.4
python setup.py install
cd ..
Manually install Python package |
"import pyquery" tested ok |
import urllib
urls=('http://ilearnblogger.blogspot.tw/2015/04/qnaplinux-tool-postgresql-from-9210.html','http://ilearnblogger.blogspot.tw/2015/03/qnaplinux-tool-postgresql-database.html')
i = 0
for url in urls:
file_path = './urls/' + str(i)
urllib.urlretrieve (url, file_path)
i = i+1
Execute .py programs |
Source code: https://github.com/ilearnblogger/pyp/blob/master/geturl.py
Learning Python is easy from the online website: Tutorialspoint - Python Programming. Enjoy!
Learning Python is easy from the online website: Tutorialspoint - Python Programming. Enjoy!
No comments :
Post a Comment