python获取文件修改时间 错误_python错误记录

raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'

没有在__init__.py文件中导入pymysql

__init__.py

importpymysql

pymysql.install_as_MySQLdb()

goods.GoodsImage.image: (fields.E210) Cannot use ImageField because Pillow is not installed.

HINT: Get Pillow at https://pypi.python.org/pypi/Pillow or run command "pip install Pillow".

没有安装pillow

pip install pillow

缩进错误:

IndentationError: unexpected indent

pip安装超时:

1.添加超时时间

pip install 要安装的包名 --timeout 100

2.修改pip配置文件

创建pip.conf文件

mkdir~/.pip

cd~/.pip

在.pip目录下创建一个pip.conf文件

touch pip.conf

文件就创建好了(当然如果你已经有这个文件了这步可以跳过).2. 编辑pip.conf文件

sudo gedit~/.pip/pip.conf

打开pip.conf文件窗口,将以下内容复制到文件中:

[global]

timeout= 6000 #修改pip等待时间

[global]

index-url = http://pypi.douban.com/simple #换源

[install]

trusted-host=pypi.douban.com

虚拟环境创建失败

OSError: Command /home/kevin2/.virtua...ramid_p2/bin/python2 - setuptools pip wheel failed with error code 2

1.升级pip

2.换源

#在.pip目录创建并编辑pip.conf#pip安装需要使用的https加密,所以在此需要添加trusted-host

[global]

trusted-host =mirrors.ustc.edu.cn

index-url = https://mirrors.ustc.edu.cn/pypi/web/simple

空文件发送:

new_client_socket.send(send_content)

TypeError: a bytes-like object is required, not 'NoneType'

Traceback (most recent call last):

File"/usr/local/bin/pip3", line 7, in

from pip importmain

File"/usr/local/lib/python3.5/dist-packages/pip/__init__.py", line 43, in

from pip.utils importget_installed_distributions, get_prog

File"/usr/local/lib/python3.5/dist-packages/pip/utils/__init__.py", line 27, in

from pip._vendor importpkg_resources

File"/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in @_call_aside

File"/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in_call_aside

f(*args, **kwargs)

File"/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in_initialize_master_working_set

dist.activate(replace=False)

File"/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, inactivate

declare_namespace(pkg)

File"/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, indeclare_namespace

_handle_ns(packageName, path_item)

File"/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2092, in_handle_ns

_rebuild_mod_path(path, packageName, module)

File"/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2121, in_rebuild_mod_path

orig_path.sort(key=position_in_sys_path)

AttributeError:'_NamespacePath' object has no attribute 'sort'

pip3 install --upgrade pip setuptools不行的时候

修改了一下"sudo vim /usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py"

#orig_path.sort(key=position_in_sys_path)#module.__path__[:] = [_normalize_cached(p) for p in orig_path]

orig_path_t =list(orig_path)

orig_path_t.sort(key=position_in_sys_path)

module.__path__[:] = [_normalize_cached(p) for p in orig_path_t]

然后我试了很多种方法,而且还根据许多其他答案pip3 install --upgrade pip setuptools等等都不行,最终还是在外文的一个讨论区找到一个,修改了一下,觉得还可以:

具体来说就是编辑文件#2121~2122 : "sudo vim /usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py"

你可能感兴趣的:(python获取文件修改时间,错误)