Install Tools
apt-get install python-setuptools
apt-get install python-dev
apt-get install libmysqlclient15-dev
easy_install -U SQLObject
easy_install MySQL-python
easy_install psycopg2
- SQLObject is a popular Object Relational Manager for providing an object interface to your database, with tables as classes, rows as instances, and columns as attributes.
- MySQL-python is the most popular MySQL adapter for the Python
- Psycopg2 is the most popular PostgreSQL adapter for the Python
Setup IMDbPY
change to IMDbPY-4.9 folder
cd ~/IMDbPY-4.9
setup IMDbPY working environment
python setup.py install
If you want to dump raw data into mysql database, so imdbpy2sql.py script can help you.
To create the tables and to populate the database, you must run the imdbpy2sql.py script:
python bin/ imdbpy2sql.py -d /dir/with/plainTextDataFiles/ -u 'URI'
Where the 'URI' argument is a string representing the connection to your database, with the schema:
scheme://[user[:password]@]host[:port]/database[?parameters]
Where 'scheme' is one in "sqlite", "mysql", "postgres", "firebird", "interbase", "maxdb", "sapdb", "mssql", "sybase", "ibm_db_sa".
Some examples:
mysql://user:password@host/database
postgres://user:password@host/database
mysql://host/database?debug=1
postgres:///full/path/to/socket/database
postgres://host:5432/database
sqlite:///full/path/to/database
sqlite:/C|/full/path/to/database
sqlite:/:memory:
Reference
- SQLObject
- Sakib's Blog - In Ubuntu the error: EnvironmentError: mysql_config not found
- askubuntu - How to get the latest IMDbPY in 10.04 LTS
Install Error
Question:
After installing python-setuptools, I try to install IMDbPY through easy_install. But I get the following error.
error: Setup script exited with error: command 'gcc' failed with exit status 1
Answer:
Sounds like you are missing python-dev. But yes, grabbing the deb from Debian unstable is the best way to go.
Question:
I was trying to install mysql-python. But the it gives me a error like this:
EnvironmentError: mysql_config not found
Then I have tried to install the mysql client and try to install mysql-python again, the result is same.
Answer:
After searching a lot, I have found a solution. Then I have followed the following steps:
in terminal:
apt-get install libmysqlclient15-dev
easy_install MySQL-python
沒有留言:
張貼留言