Python import/export problems

Source: Internet
Author: User
Tags install pandas

Python import/export problems

The final solution is as follows: I don't know if there is anything redundant.

From django. conf import settings

From sys import path
Path. extend (['/home/zoueswebsite', '/home/zoueswebsite/blog', '/home/zoueswebsite'])
Import OS

OS. environ ['django _ SETTINGS_MODULE '] = 'zoueswebsite. setting'


First version error:

The settings are as follows:

From django. conf import settings
Settings. configure ()
From sys import path
Path. extend (['/home/zoueswebsite', '/home/zoueswebsite/blog', '/home/zoueswebsite'])
From blog. models import *

Error:

Traceback (most recent call last ):
File "xmlgenerator. py", line 20, in <module>
For num, value in enumerate (Category. objects. all ()):
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query. py", line 96, in _ iter __
Self. _ fetch_all ()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query. py", line 857, in _ fetch_all
Self. _ result_cache = list (self. iterator ())
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query. py", line 220, in iterator
For row in compiler. results_iter ():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/SQL/compiler. py", line 713, in results_iter
For rows in self.exe cute_ SQL (MULTI ):
File "/usr/local/lib/python2.7/dist-packages/django/db/models/SQL/compiler. py", line 776, in execute_ SQL
SQL, params = self. as_ SQL ()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/SQL/compiler. py", line 83, in as_ SQL
Out_cols, s_params = self. get_columns (with_col_aliases)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/SQL/compiler. py", line 231, in get_columns
Col_aliases)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/SQL/compiler. py", line 306, in get_default_columns
R = '% s. % s' % (qn (alias), qn2 (field. column ))

File "/usr/local/lib/python2.7/dist-packages/django/db/models/SQL/compiler. py", line 61, in quote_name_unless_alias
R = self. connection. ops. quote_name (name)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/dummy/base. py", line 15, in complain
Raise ImproperlyConfigured ("settings. DATABASES is improperly configured ."
Django. core. exceptions. ImproperlyConfigured: settings. DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

In the first version:

Comment out this line # path. extend (['/home/zoueswebsite', '/home/zoueswebsite/blog','/home/zoueswebsite '])
An error is reported:


Root @ ay14071501351098c0ez :~ # Python xmlgenerator. py
Traceback (most recent call last ):
File "xmlgenerator. py", line 11, in <module>
From blog. models import *
ImportError: No module named blog. models

In the first version:

If you comment out OS. environ ['django _ SETTINGS_MODULE '] = 'zoueswebsite. setting' but the export does not change when it contains this setting, an error is reported when I unset it:

The first error is reported.

In the first version:

If you comment out:

# From django. conf import settings

Is irrelevant

Version 2 error:

From django. conf import settings
Settings. configure ()
From blog. models import *

EROROR;

Traceback (most recent call last ):
File "<stdin>", line 1, in <module>
ImportError: No module named blog


Python encountered problems when importing pandas

The problem you encountered was that you installed less packages. It is obviously not enough to install pandas only one package in windows. It does not include all the packages used. This is very troublesome, you can only know which packages are missing after the error message is displayed.

To sum up, you need to install the following packages:
Pyparsing-2.0.2.win32-py2.7.exe
Matplotllib-1.3.1.win32-py2.7.exe
Openpyxl-openpyxl-5d2c0c8704d2.tar.gz
Setuptools-3.8.1.win32-py2.7.exe
Numpy-MKL-1.8.1.win32-py2.7.exe
Six-1.7.3.win32-py2.7.exe
Python-dateutil-2.2.win32-py2.7.exe

These installation packages are:
Www.lfd.uci.edu /~ Gohlke/pythonlibs

Another important note is the version. The Python extension package is strictly related to the Python version. The version of the extension package varies with Python versions.

The last note is that do not mix 32-bit and 64-bit versions. All extension packages are divided into 32-bit and 64-bit versions.

In general, I personally feel that Python and Pandas are not suitable for windows operating systems, and they are much smoother to use in ubuntu. If you use it in windows, we recommend that you try esProc, which has better computing power than Pandas and is more suitable for windows.

How to add a library for python in ubuntu?

I have never done graphics. py in ubuntu.
However, I did it in windows.

1. apt is used to install Ubuntu software.
2. Python is a software under Ubuntu.
3. graphics. py is a third-party library function in python.

Therefore, apt is used to install and update python.
The python library has its own installation method.
It is common to directly install setup. py install or pip.

For specific installation methods, refer to this:
[To be improved] [summary] how to install third-party libraries and packages in Python

(No post address is provided here. Search for the title by google to find the post address)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.