我正在运行Python 3.5并尝试在命令行中运行this django app中的一些代码,这种情况一直在发生:
C:\Users\username\Envs\mysite> python service.py --startup=auto install
Traceback (most recent call last):
File "service.py", line 14, in <module>
from django_windows_tools.service import DjangoService,test_commands
File "C:\Users\username\AppData\Local\Programs\Python\Python35\lib\site-packages\django_windows_tools\service.py", line 39, in <module>
import multiprocessing.forking
ImportError: No module named 'multiprocessing.forking'
我不确定是什么导致这种情况。
答案 0 :(得分:2)
python v2.6/2.7
默认安装forking.py
,但不安装v3.5.1
[root@localhost usr]# find /usr -name multiprocessing
/usr/lib64/python2.7/multiprocessing
/usr/lib64/python3.5/multiprocessing
[root@localhost usr]# find /usr -name forking.py
/usr/lib64/python2.7/multiprocessing/forking.py
python3.5.1由于某些原因没有forking.py,你运行的软件包不支持python3,你可以在git repo上报告问题或者用python2安装它。
[root@localhost usr]# python3
Python 3.5.1 (default, Mar 4 2016, 15:21:15)
[GCC 6.0.0 20160302 (Red Hat 6.0.0-0.14)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import multiprocessing
>>> import multiprocessing.forking
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'multiprocessing.forking'
虽然python2没有问题
[root@localhost usr]# python2
Python 2.7.12 (default, Sep 2 2016, 14:46:00)
[GCC 6.1.1 20160621 (Red Hat 6.1.1-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import multiprocessing
>>> import multiprocessing.forking